home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / mint / lib / mlib44d.zoo / diffc next >
Text File  |  1994-03-01  |  139KB  |  5,339 lines

  1. *** 43.1    1994/02/15 19:34:32
  2. --- a64l.c    1994/02/28 09:32:14
  3. ***************
  4. *** 66,72 ****
  5.   
  6.   /* Local function prototypes */
  7.   static int a64i __PROTO((char c));  /* base-64 char to int, -1 on error */
  8. - static char i64a __PROTO((int i));  /* integer to base-64 char, 0x7F on error */
  9.   
  10.   /* base-64 char to int, -1 on error */
  11.   static int a64i(c)
  12. --- 66,71 ----
  13. ***************
  14. *** 112,162 ****
  15.     return(retval);
  16.   } /* End of a64l() */
  17.   
  18. - /* integer to base-64 char, 0x7F on error */
  19. - static char i64a(i)
  20. -   int i;
  21. - {
  22. -   char retval = (char)i;
  23. -   
  24. -   if ((i < 0) || (i > 63))
  25. -   {
  26. -     errno = EBADARG;
  27. -     return(0x7F);
  28. -   }
  29. -   retval += '.';
  30. -   if (i > 11)
  31. -     retval += 'A' - '9' - 1;
  32. -   if (i > 37)
  33. -     retval += 'a' - 'Z' - 1;
  34. -   return(retval);
  35. - } /* End of i64a() */
  36. - /* long to base-64 string */
  37. - char *l64a(l)
  38. -   long l;
  39. - {
  40. -   static char retval[7];
  41. -   char buffer[7], *ptr1 = buffer, *ptr2 = retval;
  42. -   int counter = 0;
  43. -   if (l < 0)
  44. -   {
  45. -     errno = EBADARG;
  46. -     return("");
  47. -   }
  48. -   if (l == 0)
  49. -     return("");
  50. -   while ((counter++ < 6) && (l > 0))
  51. -   {
  52. -     char val;
  53. -     
  54. -     if ((val = i64a((char)(l & 0x3F))) == 0x7F)
  55. -       return(""); /* errno was set by i64a() */
  56. -     *ptr1++ = val;
  57. -     l >>= 6;
  58. -   }
  59. -   while (ptr1 > buffer)
  60. -     *ptr2++ = *(--ptr1);
  61. -   *ptr2 = 0x00;
  62. -   return(retval);
  63. - } /* End of l64a() */
  64. --- 111,113 ----
  65. *** 43.1    1994/02/15 19:34:32
  66. --- abort.c    1994/02/27 13:14:44
  67. ***************
  68. *** 1,4 ****
  69. ! /* ERS */
  70.   
  71.   #include <signal.h>
  72.   #include <stdlib.h>
  73. --- 1,4 ----
  74. ! /* by ERS, modified by entropy */
  75.   
  76.   #include <signal.h>
  77.   #include <stdlib.h>
  78. ***************
  79. *** 17,31 ****
  80.   {
  81.   #ifdef __MINT__
  82.       if (__mint)
  83.           (void) Pkill(Pgetpid(), SIGABRT);
  84. ! #if 0
  85. !     /* Do not do this because it violates POSIX (raise() and
  86. !        kill() are available for the user unless <signal.h> is
  87. !        included in user's source).  Fix later.
  88. !     */
  89.       else
  90.           raise(SIGABRT);
  91. - #endif
  92.       _fclose_all_files();
  93.       _exit(127);
  94.   #else
  95. --- 17,33 ----
  96.   {
  97.   #ifdef __MINT__
  98.       if (__mint)
  99. +         {
  100.           (void) Pkill(Pgetpid(), SIGABRT);
  101. !         /* process still alive, maybe SIGABRT was blocked */
  102. !         (void) Psigsetmask(Psigblock(0) & ~(sigmask(SIGABRT)));
  103. !         /* process still alive, maybe SIGABRT was ignored */
  104. !         /* is this correct if user SIGABRT handler returns? */
  105. !         (void) Psignal(SIGABRT, (long) SIG_DFL);
  106. !         (void) Pkill(Pgetpid(), SIGABRT);
  107. !         }
  108.       else
  109.           raise(SIGABRT);
  110.       _fclose_all_files();
  111.       _exit(127);
  112.   #else
  113. *** 43.1    1994/02/15 19:34:32
  114. --- abs.c    1994/02/28 12:17:48
  115. ***************
  116. *** 4,17 ****
  117.   #ifdef abs
  118.   #undef abs
  119.   #endif
  120. - #ifdef labs
  121. - #undef labs
  122. - #endif
  123.   
  124.   int abs(x)
  125. ! int x;
  126. ! { return x < 0 ? -x : x; }
  127. ! long labs(x)
  128. ! long x;
  129. ! { return x < 0 ? -x : x; }
  130. --- 4,12 ----
  131.   #ifdef abs
  132.   #undef abs
  133.   #endif
  134.   
  135.   int abs(x)
  136. !   int x;
  137. ! {
  138. !   return x < 0 ? -x : x;
  139. ! }
  140. *** /dev/null    Mon Feb 28 07:43:04 1994
  141. --- atoi.c    Mon Feb 28 04:38:26 1994
  142. ***************
  143. *** 0 ****
  144. --- 1,13 ----
  145. + #include <stddef.h>
  146. + #include <stdlib.h>
  147. + #include <assert.h>
  148. + __EXTERN long strtol __PROTO((const char *, char **, int));
  149. + int
  150. + atoi(str)
  151. + const char *str;
  152. + {
  153. +     assert ((str != NULL));
  154. +     return (int) strtol(str, (char **)0, 10);
  155. + }
  156. *** 43.1    1994/02/15 19:34:32
  157. --- atol.c    1994/02/28 09:38:36
  158. ***************
  159. *** 6,19 ****
  160.   
  161.   __EXTERN long strtol __PROTO((const char *, char **, int));
  162.   
  163. ! int atoi(str)
  164. ! const char *str;
  165. ! {
  166. !     assert ((str != NULL));
  167. !     return (int) strtol(str, (char **)0, 10);
  168. ! }
  169. ! long atol(str)
  170.   const char *str;
  171.   {
  172.       assert ((str != NULL));
  173. --- 6,13 ----
  174.   
  175.   __EXTERN long strtol __PROTO((const char *, char **, int));
  176.   
  177. ! long
  178. ! atol(str)
  179.   const char *str;
  180.   {
  181.       assert ((str != NULL));
  182. *** 43.1    1994/02/15 19:34:32
  183. --- chmod.c    1994/02/28 09:50:08
  184. ***************
  185. *** 1,5 ****
  186.   /* chmod -- change the permissions of a file */
  187. - /* chown -- change the owner and group of a file */
  188.   /* written by Eric R. Smith and placed in the public domain */
  189.   
  190.   #include <types.h>
  191. --- 1,4 ----
  192. ***************
  193. *** 13,19 ****
  194.   
  195.   extern int __mint;
  196.   
  197. ! int chmod(_path, mode)
  198.          const char *_path;
  199.          int   mode;
  200.   {
  201. --- 12,19 ----
  202.   
  203.   extern int __mint;
  204.   
  205. ! int
  206. ! chmod(_path, mode)
  207.          const char *_path;
  208.          int   mode;
  209.   {
  210. ***************
  211. *** 60,84 ****
  212.          return 0;
  213.   }
  214.   
  215. - /*
  216. -  * chown: this is faked if MiNT is not running
  217. -  */
  218. - int chown(_name, uid, gid)
  219. -        const char *_name;
  220. -        int uid, gid;
  221. - {
  222. -     int r;
  223. -     char name[PATH_MAX];
  224. -     if (__mint >= 9) {
  225. -         (void)_unx2dos(_name, name);
  226. -         r = (int)Fchown(name, uid, gid);
  227. -         if (r && (r != -EINVAL)) {
  228. -             errno = -r;
  229. -             return -1;
  230. -         }
  231. -         return 0;
  232. -     }
  233. -     return 0;
  234. - }
  235. --- 60,62 ----
  236. *** /dev/null    Mon Feb 28 07:43:04 1994
  237. --- chown.c    Mon Feb 28 04:50:02 1994
  238. ***************
  239. *** 0 ****
  240. --- 1,34 ----
  241. + /* chown -- change the owner and group of a file */
  242. + /* written by Eric R. Smith and placed in the public domain */
  243. + /* this is faked if MiNT is not running */
  244. + #include <types.h>
  245. + #include <stat.h>
  246. + #include <osbind.h>
  247. + #include <mintbind.h>
  248. + #include <limits.h>
  249. + #include <errno.h>
  250. + #include <unistd.h>
  251. + #include "lib.h"
  252. + extern int __mint;
  253. + int
  254. + chown(_name, uid, gid)
  255. +        const char *_name;
  256. +        int uid, gid;
  257. + {
  258. +     int r;
  259. +     char name[PATH_MAX];
  260. +     if (__mint >= 9) {
  261. +         (void)_unx2dos(_name, name);
  262. +         r = (int)Fchown(name, uid, gid);
  263. +         if (r && (r != -EINVAL)) {
  264. +             errno = -r;
  265. +             return -1;
  266. +         }
  267. +         return 0;
  268. +     }
  269. +     return 0;
  270. + }
  271. *** 43.1    1994/02/15 19:34:32
  272. --- div.c    1994/02/28 10:12:58
  273. ***************
  274. *** 1,5 ****
  275.   /*
  276. !  * div and ldiv
  277.    *    this one should be compat with -fpcc-struct-return
  278.    *
  279.    *    ++jrb    bammi@dsrgsun.ces.cwru.edu
  280. --- 1,5 ----
  281.   /*
  282. !  * div
  283.    *    this one should be compat with -fpcc-struct-return
  284.    *
  285.    *    ++jrb    bammi@dsrgsun.ces.cwru.edu
  286. ***************
  287. *** 11,17 ****
  288.   long __divsi3(long, long);    /* returns: quot in d0.l  remainder in d1.l */
  289.   
  290.   #ifdef __MSHORT__
  291. ! div_t div(int num, int denom)
  292.   {
  293.       div_t     result;
  294.   
  295. --- 11,18 ----
  296.   long __divsi3(long, long);    /* returns: quot in d0.l  remainder in d1.l */
  297.   
  298.   #ifdef __MSHORT__
  299. ! div_t
  300. ! div(int num, int denom)
  301.   {
  302.       div_t     result;
  303.   
  304. ***************
  305. *** 29,52 ****
  306.   #else /* !__MSHORT__ */
  307.   __asm__(".stabs \"_div\",5,0,0,_ldiv");
  308.   #endif
  309. - ldiv_t ldiv(long num, long denom)
  310. - {
  311. -     ldiv_t    result;
  312. -     __asm__ volatile("\
  313. -          movl    %3,sp@-
  314. -         movl    %2,sp@-
  315. -         jsr    ___divsi3
  316. -         addqw    #8,sp
  317. -         movl    d0,%0
  318. -         movl    d1,%1"
  319. -         : "=g"(result.quot), "=g"(result.rem)
  320. -         : "r"(num), "r"(denom)
  321. -         ); /* compiler dependency, dont tell gcc about d0,d1 clobb */
  322. -     return result;
  323. - }
  324.   #else /* !__GNUC__ */
  325.   
  326.   div_t
  327. --- 30,35 ----
  328. ***************
  329. *** 54,71 ****
  330.   int num, denom;
  331.   {
  332.       div_t res;
  333. -     
  334. -     res.quot = num / denom;
  335. -     res.rem = num % denom;
  336. -     
  337. -     return res;
  338. - }
  339. - ldiv_t
  340. - ldiv(num, denom)
  341. - long num, denom;
  342. - {
  343. -     ldiv_t res;
  344.       
  345.       res.quot = num / denom;
  346.       res.rem = num % denom;
  347. --- 37,42 ----
  348. *** /dev/null    Mon Feb 28 07:43:04 1994
  349. --- fgetpos.c    Mon Feb 28 06:30:12 1994
  350. ***************
  351. *** 0 ****
  352. --- 1,19 ----
  353. + /* from Dale Schumacher's dLibs */
  354. + #include <stdio.h>
  355. + int
  356. + fgetpos(fp, pos)
  357. +   FILE *fp;
  358. +   fpos_t *pos;
  359. + {
  360. +   register long rv;
  361. +   rv = ftell(fp);
  362. +   if ((rv >= 0) && pos)
  363. +   {
  364. +     *pos = rv;
  365. +     return (0);
  366. +   }
  367. +   return (-1);
  368. + }
  369. *** 43.1    1994/02/15 19:34:32
  370. --- fopen.c    1994/02/28 11:06:46
  371. ***************
  372. *** 5,160 ****
  373.   #include <fcntl.h>
  374.   #include <unistd.h>
  375.   #include <errno.h>
  376.   
  377.   __EXTERN void _getbuf __PROTO((FILE *));
  378. - static FILE *_fopen __PROTO((const char *, const char *, FILE *));
  379.   
  380. ! extern int __mint;
  381. ! /* lowest character device handle # */
  382. ! #define    LAST_DEVICE    __SMALLEST_VALID_HANDLE
  383. ! extern int __default_mode__;
  384. ! static FILE *_fopen(filename, mode, fp)
  385. !     const char *filename;
  386. !     const char *mode;
  387. !     FILE *fp;
  388. ! /*
  389. !  *    INTERNAL FUNCTION.  Attempt to open <filename> in the given
  390. !  *    <mode> and attach it to the stream <fp>
  391. !  */
  392. !     {
  393. !     register int h, i, iomode = 0, f = __default_mode__;
  394. !     while(*mode)
  395. !         {
  396. !         switch(*mode++)
  397. !             {
  398. !             case 'r':
  399. !                 f |= _IOREAD;
  400. !                 break;
  401. !             case 'w':
  402. !                 f |= _IOWRT;
  403. !                 iomode |= (O_CREAT | O_TRUNC);
  404. !                 break;
  405. !             case 'a':
  406. !                 f |= _IOWRT;
  407. !                 iomode |= (O_CREAT | O_APPEND);
  408. !                 break;
  409. !             case '+':
  410. !                 f &= ~(_IOREAD | _IOWRT);
  411. !                 f |= _IORW;
  412. !                 break;
  413. !             case 'b':
  414. !                 f |= _IOBIN;
  415. !                 break;
  416. !             case 't':
  417. !                 f &= ~_IOBIN;
  418. !                 break;
  419. !             default:
  420. !                 return(NULL);
  421. !             }
  422. !         }
  423. !     if((i = (f & (_IORW | _IOREAD | _IOWRT))) == 0)
  424. !         return(NULL);
  425. !     else if(i == _IOREAD)
  426. !         iomode |= O_RDONLY;
  427. !     else if(i == _IOWRT)
  428. !         iomode |= O_WRONLY;
  429. !     else
  430. !         iomode |= O_RDWR;
  431. !     iomode |= O_NOCTTY;
  432. !     h = open(filename, iomode, 0666);
  433. !     if(h < __SMALLEST_VALID_HANDLE)
  434. !         {
  435. !         return(NULL);        /* file open/create error */
  436. !         }
  437. !     if(isatty(h))
  438. !         f |= __mint ? (_IODEV | _IONBF| _IOBIN) : (_IODEV | _IONBF);
  439. !     else
  440. !         f |= _IOFBF;
  441. !     fp->_file = h;            /* file handle */
  442. !     fp->_flag = f;            /* file status flags */
  443. !     if (iomode & O_APPEND)
  444. !         (void) fseek(fp, 0L, SEEK_END);
  445. !     return(fp);
  446. !     }
  447. ! FILE *fopen(filename, mode)
  448. !     const char *filename, *mode;
  449. !     {
  450. !     register int i;
  451. !     register FILE *fp = NULL;
  452. !     for(i=0; (!fp && (i < _NFILE)); ++i)
  453. !         if(!(_iob[i]._flag & (_IORW | _IOREAD | _IOWRT))) 
  454. !             fp = &_iob[i]; /* empty slot */
  455. !     if(fp != NULL)
  456. !     {
  457. !         if(_fopen(filename, mode, fp) == NULL)
  458. !             return NULL;
  459. !         _getbuf(fp);
  460. !         return fp;
  461. !     }
  462. !     else
  463. !       {
  464. !         errno = EMFILE;
  465. !         return NULL;
  466. !       }
  467. !     }
  468. ! /*
  469. !  * re-coded,  foobared code deleted
  470. !  *
  471. !  *    ++jrb
  472. !  */
  473. ! FILE *freopen(filename, mode, fp)
  474.       const char *filename, *mode;
  475. -     FILE *fp;
  476.   {
  477. !     unsigned int f;
  478. !     
  479. !     if(fp == NULL) return NULL;
  480. !     
  481. !     f = fp->_flag;
  482. !     if((f & (_IORW | _IOREAD | _IOWRT)) != 0)
  483. !     { /* file not closed, close it */
  484. ! #if 0
  485. !         if(fflush(fp) != 0) return NULL;            /* flush err */
  486. !         if(close(fp->_file) != 0) return NULL;        /* close err */
  487. ! #else
  488. !     fflush(fp);                /* ANSI says ignore errors */
  489. !     if (__mint || !(f & _IODEV))        /* leave tty's alone */
  490. !       close(fp->_file);
  491. ! #endif
  492. !     }
  493. !     /* save buffer discipline and setbuf settings, and _IOWRT just for
  494. !        determinining line buffering after the next _fopen */
  495. !     f &= (_IOFBF | _IOLBF | _IONBF | _IOMYBUF | _IOWRT);
  496. !     /* open the new file according to mode */
  497. !     if((fp = _fopen(filename, mode, fp)) == NULL)
  498. !     return NULL;
  499. !     if(fp->_flag & _IODEV)
  500. !     { /* we are re-opening to a tty */
  501. !     if((f & _IOFBF) && (f & _IOWRT) && (f & _IOMYBUF))
  502. !     {   /* was a FBF & WRT & !setvbuff'ed  */
  503. !         /* reset to line buffering */
  504. !         f &= ~_IOFBF;
  505. !         f |=  _IOLBF;
  506. !     }
  507. !     }
  508. !     f &= ~_IOWRT; /* get rid of saved _IOWRT flag */
  509. !     
  510. !     /* put buffering and discipline flags in new fp->_flag */
  511. !     fp->_flag &= ~(_IONBF | _IOLBF | _IOFBF | _IOMYBUF);
  512. !     fp->_flag |= f;
  513. !     
  514. !     if (fp->_base == NULL)
  515. !       /* get new buffer if file was closed */
  516. !       _getbuf (fp);
  517.   
  518.       return fp;
  519. !     }
  520. --- 5,34 ----
  521.   #include <fcntl.h>
  522.   #include <unistd.h>
  523.   #include <errno.h>
  524. + #include "lib.h"
  525.   
  526.   __EXTERN void _getbuf __PROTO((FILE *));
  527.   
  528. ! FILE *
  529. ! fopen(filename, mode)
  530.       const char *filename, *mode;
  531.   {
  532. !   register int i;
  533. !   register FILE *fp = NULL;
  534.   
  535. +   for (i=0; (!fp && (i < _NFILE)); ++i)
  536. +     if (!(_iob[i]._flag & (_IORW | _IOREAD | _IOWRT))) 
  537. +       fp = &_iob[i]; /* empty slot */
  538. +   if (fp != NULL)
  539. +   {
  540. +     if (_fopen_i(filename, mode, fp) == NULL)
  541. +       return NULL;
  542. +     _getbuf(fp);
  543.       return fp;
  544. !   }
  545. !   else
  546. !   {
  547. !     errno = EMFILE;
  548. !     return NULL;
  549. !   }
  550. ! }
  551. *** /dev/null    Mon Feb 28 07:43:04 1994
  552. --- fopen_i.c    Mon Feb 28 06:06:38 1994
  553. ***************
  554. *** 0 ****
  555. --- 1,79 ----
  556. + /* from Dale Schumacher's dLibs */
  557. + #include <stdio.h>
  558. + #include <stdlib.h>
  559. + #include <fcntl.h>
  560. + #include <unistd.h>
  561. + #include "lib.h"
  562. + extern int __mint;
  563. + extern int __default_mode__;
  564. + FILE *
  565. + _fopen_i(filename, mode, fp)
  566. +     const char *filename;
  567. +     const char *mode;
  568. +     FILE *fp;
  569. + /*
  570. +  *    INTERNAL FUNCTION.  Attempt to open <filename> in the given
  571. +  *    <mode> and attach it to the stream <fp>
  572. +  */
  573. +     {
  574. +     register int h, i, iomode = 0, f = __default_mode__;
  575. +     while (*mode)
  576. +         {
  577. +         switch (*mode++)
  578. +             {
  579. +             case 'r':
  580. +                 f |= _IOREAD;
  581. +                 break;
  582. +             case 'w':
  583. +                 f |= _IOWRT;
  584. +                 iomode |= (O_CREAT | O_TRUNC);
  585. +                 break;
  586. +             case 'a':
  587. +                 f |= _IOWRT;
  588. +                 iomode |= (O_CREAT | O_APPEND);
  589. +                 break;
  590. +             case '+':
  591. +                 f &= ~(_IOREAD | _IOWRT);
  592. +                 f |= _IORW;
  593. +                 break;
  594. +             case 'b':
  595. +                 f |= _IOBIN;
  596. +                 break;
  597. +             case 't':
  598. +                 f &= ~_IOBIN;
  599. +                 break;
  600. +             default:
  601. +                 return(NULL);
  602. +             }
  603. +         }
  604. +     if ((i = (f & (_IORW | _IOREAD | _IOWRT))) == 0)
  605. +         return(NULL);
  606. +     else if (i == _IOREAD)
  607. +         iomode |= O_RDONLY;
  608. +     else if (i == _IOWRT)
  609. +         iomode |= O_WRONLY;
  610. +     else
  611. +         iomode |= O_RDWR;
  612. +     iomode |= O_NOCTTY;
  613. +     h = open(filename, iomode, 0666);
  614. +     if (h < __SMALLEST_VALID_HANDLE)
  615. +         {
  616. +         return(NULL);        /* file open/create error */
  617. +         }
  618. +     if (isatty(h))
  619. +         f |= __mint ? (_IODEV | _IONBF| _IOBIN) : (_IODEV | _IONBF);
  620. +     else
  621. +         f |= _IOFBF;
  622. +     fp->_file = h;            /* file handle */
  623. +     fp->_flag = f;            /* file status flags */
  624. +     if (iomode & O_APPEND)
  625. +         (void) fseek(fp, 0L, SEEK_END);
  626. +     return (fp);
  627. +     }
  628. *** 43.1    1994/02/15 19:34:32
  629. --- fputs.c    1994/02/28 11:12:14
  630. ***************
  631. *** 4,33 ****
  632.   #include <stddef.h>
  633.   #include <assert.h>
  634.   
  635. ! int fputs(data, fp)
  636. !     register const char *data;
  637. !     register FILE *fp;
  638. !     {
  639. !     register int n = 0;
  640.       
  641. !     assert((data != NULL));
  642. !     while(*data)
  643. !         {
  644. !         if(fputc(*data++, fp) == EOF)
  645. !             return(EOF);
  646. !         ++n;
  647. !         }
  648. !     return(n);
  649. !     }
  650. ! int puts(data)
  651. !     const char *data;
  652. !     {
  653. !     register int n;
  654. !     assert((data != NULL));
  655. !     if(((n = fputs(data, stdout)) == EOF)
  656. !     || (fputc('\n', stdout) == EOF))
  657. !         return(EOF);
  658. !     return(++n);
  659. !     }
  660. --- 4,22 ----
  661.   #include <stddef.h>
  662.   #include <assert.h>
  663.   
  664. ! int
  665. ! fputs(data, fp)
  666. !   register const char *data;
  667. !   register FILE *fp;
  668. ! {
  669. !   register int n = 0;
  670.       
  671. !   assert((data != NULL));
  672. !   while (*data)
  673. !   {
  674. !     if (fputc(*data++, fp) == EOF)
  675. !       return (EOF);
  676. !     ++n;
  677. !   }
  678. !   return (n);
  679. ! }
  680. *** /dev/null    Mon Feb 28 07:43:04 1994
  681. --- freopen.c    Mon Feb 28 06:08:30 1994
  682. ***************
  683. *** 0 ****
  684. --- 1,65 ----
  685. + /* from Dale Schumacher's dLibs */
  686. + #include <stdio.h>
  687. + #include <stdlib.h>
  688. + #include <fcntl.h>
  689. + #include <unistd.h>
  690. + #include "lib.h"
  691. + extern int __mint;
  692. + /*
  693. +  * re-coded,  foobared code deleted
  694. +  *
  695. +  *    ++jrb
  696. +  */
  697. + FILE *
  698. + freopen(filename, mode, fp)
  699. +     const char *filename, *mode;
  700. +     FILE *fp;
  701. + {
  702. +     unsigned int f;
  703. +     
  704. +     if (fp == NULL)
  705. +     return NULL;
  706. +     
  707. +     f = fp->_flag;
  708. +     if ((f & (_IORW | _IOREAD | _IOWRT)) != 0)
  709. +     { /* file not closed, close it */
  710. + #if 0
  711. +         if (fflush(fp) != 0) return NULL;            /* flush err */
  712. +         if (close(fp->_file) != 0) return NULL;        /* close err */
  713. + #else
  714. +     fflush(fp);                /* ANSI says ignore errors */
  715. +     if (__mint || !(f & _IODEV))        /* leave tty's alone */
  716. +       close(fp->_file);
  717. + #endif
  718. +     }
  719. +     /* save buffer discipline and setbuf settings, and _IOWRT just for
  720. +        determinining line buffering after the next _fopen_i */
  721. +     f &= (_IOFBF | _IOLBF | _IONBF | _IOMYBUF | _IOWRT);
  722. +     /* open the new file according to mode */
  723. +     if ((fp = _fopen_i(filename, mode, fp)) == NULL)
  724. +     return NULL;
  725. +     if (fp->_flag & _IODEV)
  726. +     { /* we are re-opening to a tty */
  727. +     if ((f & _IOFBF) && (f & _IOWRT) && (f & _IOMYBUF))
  728. +     {   /* was a FBF & WRT & !setvbuff'ed  */
  729. +         /* reset to line buffering */
  730. +         f &= ~_IOFBF;
  731. +         f |=  _IOLBF;
  732. +     }
  733. +     }
  734. +     f &= ~_IOWRT; /* get rid of saved _IOWRT flag */
  735. +     
  736. +     /* put buffering and discipline flags in new fp->_flag */
  737. +     fp->_flag &= ~(_IONBF | _IOLBF | _IOFBF | _IOMYBUF);
  738. +     fp->_flag |= f;
  739. +     
  740. +     if (fp->_base == NULL)
  741. +       /* get new buffer if file was closed */
  742. +       _getbuf (fp);
  743. +     return fp;
  744. + }
  745. *** 43.1    1994/02/15 19:34:32
  746. --- fseek.c    1994/02/28 11:26:22
  747. ***************
  748. *** 5,51 ****
  749.   #include <stdio.h>
  750.   #include <unistd.h>
  751.   
  752. ! long ftell(fp)
  753. ! FILE *fp;
  754. ! {
  755. !     long rv, count = fp->_cnt, adjust = 0;
  756. !     unsigned int f = fp->_flag;
  757. !     if( ((f & _IOREAD) && (!(f & _IOBIN))) ||
  758. !        (count == 0)               ||
  759. !        (f & _IONBF) )
  760. !     {
  761. !     fflush(fp);    
  762. !     rv = lseek(fp->_file, 0L, SEEK_CUR);
  763. !     }
  764. !     else
  765. !     {
  766. !     if(f & _IOREAD)
  767. !         adjust = -count;
  768. !     else if(f & (_IOWRT | _IORW))
  769. !     {
  770. !         if(f & _IOWRT)
  771. !         adjust = count;
  772. !     }
  773. !     else return -1L;
  774. !     rv = lseek(fp->_file, 0L, SEEK_CUR);
  775. !     }
  776. !     return (rv < 0) ? -1L : rv + adjust;
  777. ! }
  778. ! void rewind(fp)
  779. ! register FILE *fp;
  780. ! {
  781. !     fflush(fp);
  782. !     (void) lseek(fp->_file, 0L, SEEK_SET);
  783. !     fp->_flag &= ~(_IOEOF|_IOERR);
  784. ! }
  785. ! int fseek(fp, offset, origin)
  786. ! FILE *fp;
  787. ! long offset;
  788. ! int origin;
  789.   {
  790.       long pos, count;
  791.       unsigned int f;
  792. --- 5,15 ----
  793.   #include <stdio.h>
  794.   #include <unistd.h>
  795.   
  796. ! int
  797. ! fseek(fp, offset, origin)
  798. !   FILE *fp;
  799. !   long offset;
  800. !   int origin;
  801.   {
  802.       long pos, count;
  803.       unsigned int f;
  804. *** 43.1    1994/02/15 19:34:32
  805. --- fsetpos.c    1994/02/28 11:29:28
  806. ***************
  807. *** 2,38 ****
  808.   
  809.   #include <stdio.h>
  810.   
  811. ! #define ERROR -1
  812.   
  813. ! int fgetpos(fp, pos)
  814. !     FILE *fp;
  815. !     fpos_t *pos;
  816. !     {
  817. !     register long rv;
  818. !     rv = ftell(fp);
  819. !     if((rv >= 0) && pos)
  820. !         {
  821. !         *pos = rv;
  822. !         return(0);
  823. !         }
  824. !     return(ERROR);
  825. !     }
  826. ! int fsetpos(fp, pos)
  827. !     FILE *fp;
  828. !     fpos_t *pos;
  829. !     {
  830. !     register long rv;
  831. !     if(pos)
  832. !         {
  833. !         rv = fseek(fp, *pos, SEEK_SET);
  834. !         if(rv >= 0)
  835. !             {
  836. !             fp->_flag &= ~(_IOEOF|_IOERR);
  837. !             return(0);
  838. !             }
  839. !         }
  840. !     return(ERROR);
  841. !     }
  842. --- 2,22 ----
  843.   
  844.   #include <stdio.h>
  845.   
  846. ! int
  847. ! fsetpos(fp, pos)
  848. !   FILE *fp;
  849. !   fpos_t *pos;
  850. ! {
  851. !   register long rv;
  852.   
  853. !   if (pos)
  854. !   {
  855. !     rv = fseek(fp, *pos, SEEK_SET);
  856. !     if (rv >= 0)
  857. !     {
  858. !       fp->_flag &= ~(_IOEOF|_IOERR);
  859. !       return (0);
  860. !     }
  861. !   }
  862. !   return (-1);
  863. ! }
  864. *** /dev/null    Mon Feb 28 07:43:04 1994
  865. --- ftell.c    Mon Feb 28 06:23:50 1994
  866. ***************
  867. *** 0 ****
  868. --- 1,36 ----
  869. + /* something like the origonal
  870. +  * from Dale Schumacher's dLibs
  871. +  */
  872. + #include <stdio.h>
  873. + #include <unistd.h>
  874. + long
  875. + ftell(fp)
  876. +   FILE *fp;
  877. + {
  878. +   long rv, count = fp->_cnt, adjust = 0;
  879. +   unsigned int f = fp->_flag;
  880. +   if (((f & _IOREAD) && (!(f & _IOBIN)))
  881. +       || (count == 0)
  882. +       || (f & _IONBF))
  883. +   {
  884. +     fflush(fp);    
  885. +     rv = lseek(fp->_file, 0L, SEEK_CUR);
  886. +   }
  887. +   else
  888. +   {
  889. +     if (f & _IOREAD)
  890. +       adjust = -count;
  891. +     else if (f & (_IOWRT | _IORW))
  892. +     {
  893. +       if(f & _IOWRT)
  894. +         adjust = count;
  895. +     }
  896. +     else return -1L;
  897. +     rv = lseek(fp->_file, 0L, SEEK_CUR);
  898. +   }
  899. +   return (rv < 0) ? -1L : rv + adjust;
  900. + }
  901. *** /dev/null    Mon Feb 28 07:43:04 1994
  902. --- getegid.c    Mon Feb 28 07:03:30 1994
  903. ***************
  904. *** 0 ****
  905. --- 1,12 ----
  906. + #include <types.h>
  907. + #include <unistd.h>
  908. + #include <mintbind.h>
  909. + extern int __mint;
  910. + gid_t
  911. + getegid()
  912. + {
  913. +   return __mint >= 95 ? Pgetegid() : getgid();
  914. + }
  915. *** /dev/null    Mon Feb 28 07:43:04 1994
  916. --- geteuid.c    Mon Feb 28 07:02:50 1994
  917. ***************
  918. *** 0 ****
  919. --- 1,11 ----
  920. + #include <types.h>
  921. + #include <unistd.h>
  922. + #include <mintbind.h>
  923. + extern int __mint;
  924. + uid_t
  925. + geteuid()
  926. + {
  927. +   return __mint >= 95 ? Pgeteuid() : getuid();
  928. + }
  929. *** /dev/null    Mon Feb 28 07:43:04 1994
  930. --- getgid.c    Mon Feb 28 07:02:34 1994
  931. ***************
  932. *** 0 ****
  933. --- 1,12 ----
  934. + #include <types.h>
  935. + #include <unistd.h>
  936. + #include <mintbind.h>
  937. + extern int __mint;
  938. + extern gid_t __gid;
  939. + gid_t
  940. + getgid()
  941. + {
  942. +   return __mint ? Pgetgid() : __gid;
  943. + }
  944. *** 43.1    1994/02/15 19:34:32
  945. --- getpid.c    1994/02/28 11:42:08
  946. ***************
  947. *** 5,9 ****
  948.   
  949.   extern int __mint;
  950.   
  951. ! int getpid() { return __mint ? Pgetpid() : (int) ( ((long)_base) >> 8 ); }
  952. ! int getppid() { return __mint ? Pgetppid() : (int) (((long)(_base->p_parent)) >> 8); }
  953. --- 5,12 ----
  954.   
  955.   extern int __mint;
  956.   
  957. ! int
  958. ! getpid()
  959. ! {
  960. !   return __mint ? Pgetpid() : (int) ( ((long)_base) >> 8 );
  961. ! }
  962. *** /dev/null    Mon Feb 28 07:43:04 1994
  963. --- getppid.c    Mon Feb 28 06:41:40 1994
  964. ***************
  965. *** 0 ****
  966. --- 1,12 ----
  967. + #include <osbind.h>
  968. + #include <unistd.h>
  969. + #include <basepage.h>
  970. + #include <mintbind.h>
  971. + extern int __mint;
  972. + int
  973. + getppid()
  974. + {
  975. +   return __mint ? Pgetppid() : (int) (((long)(_base->p_parent)) >> 8);
  976. + }
  977. *** 43.1    1994/02/15 19:34:32
  978. --- getuid.c    1994/02/28 12:01:08
  979. ***************
  980. *** 1,71 ****
  981. ! #ifdef __TURBOC__
  982. ! #include <sys\types.h>
  983. ! #else
  984. ! #include <sys/types.h>
  985. ! #endif
  986.   #include <unistd.h>
  987.   #include <osbind.h>
  988.   #include <mintbind.h>
  989. - #include <errno.h>
  990.   
  991.   extern int __mint;
  992.   
  993. ! static int __uid = 0, __gid = 0;
  994. ! uid_t getuid() { return __mint ? Pgetuid() : __uid; }
  995. ! gid_t getgid() { return __mint ? Pgetgid() : __gid; }
  996. ! uid_t geteuid()
  997. ! { return __mint >= 95 ? Pgeteuid() : getuid(); }
  998. ! gid_t getegid()
  999. ! { return __mint >= 95 ? Pgetegid() : getgid(); }
  1000. ! int setuid(x)
  1001. !     int x;
  1002. ! {
  1003. !     long r;
  1004. !     if (__mint) {
  1005. !         r = Psetuid(x);
  1006. !         if (r < 0) {
  1007. !             errno = (int) -r;
  1008. !             return -1;
  1009. !         }
  1010. !         return 0;
  1011. !     }
  1012. !     __uid = x;
  1013. !     return 0;
  1014. ! }
  1015. ! int setgid(x)
  1016. !     int x;
  1017.   {
  1018. !     long r;
  1019. !     if (__mint) {
  1020. !         r = Psetgid(x);
  1021. !         if (r < 0) {
  1022. !             errno = (int) -r;
  1023. !             return -1;
  1024. !         }
  1025. !         return 0;
  1026. !     }
  1027. !     __gid = x;
  1028. !     return 0;
  1029. ! }
  1030. ! int setreuid(ruid,euid)
  1031. !     int ruid, euid;
  1032. ! {
  1033. !     return setuid(euid);
  1034.   }
  1035. - int setregid(rgid,egid)
  1036. -     int rgid, egid;
  1037. - {
  1038. -     return setgid(egid);
  1039. - }
  1040. - int seteuid(x) int x; { return setuid(x); }
  1041. - int setegid(x) int x; { return setgid(x); }
  1042. --- 1,13 ----
  1043. ! #include <types.h>
  1044.   #include <unistd.h>
  1045.   #include <osbind.h>
  1046.   #include <mintbind.h>
  1047.   
  1048.   extern int __mint;
  1049. + extern uid_t __uid;
  1050.   
  1051. ! uid_t
  1052. ! getuid()
  1053.   {
  1054. !   return __mint ? Pgetuid() : __uid;
  1055.   }
  1056. *** /dev/null    Mon Feb 28 07:43:04 1994
  1057. --- l64a.c    Mon Feb 28 04:32:22 1994
  1058. ***************
  1059. *** 0 ****
  1060. --- 1,58 ----
  1061. + #include <support.h>
  1062. + #include <errno.h>
  1063. + extern int errno;
  1064. + #ifndef _COMPILER_H
  1065. + #include <compiler.h>
  1066. + #endif
  1067. + static char i64a __PROTO((int i));  /* integer to base-64 char, 0x7F on error */
  1068. + /* integer to base-64 char, 0x7F on error */
  1069. + static char i64a(i)
  1070. +   int i;
  1071. + {
  1072. +   char retval = (char)i;
  1073. +   
  1074. +   if ((i < 0) || (i > 63))
  1075. +   {
  1076. +     errno = EBADARG;
  1077. +     return(0x7F);
  1078. +   }
  1079. +   retval += '.';
  1080. +   if (i > 11)
  1081. +     retval += 'A' - '9' - 1;
  1082. +   if (i > 37)
  1083. +     retval += 'a' - 'Z' - 1;
  1084. +   return(retval);
  1085. + } /* End of i64a() */
  1086. + /* long to base-64 string */
  1087. + char *l64a(l)
  1088. +   long l;
  1089. + {
  1090. +   static char retval[7];
  1091. +   char buffer[7], *ptr1 = buffer, *ptr2 = retval;
  1092. +   int counter = 0;
  1093. +   if (l < 0)
  1094. +   {
  1095. +     errno = EBADARG;
  1096. +     return("");
  1097. +   }
  1098. +   if (l == 0)
  1099. +     return("");
  1100. +   while ((counter++ < 6) && (l > 0))
  1101. +   {
  1102. +     char val;
  1103. +     
  1104. +     if ((val = i64a((char)(l & 0x3F))) == 0x7F)
  1105. +       return(""); /* errno was set by i64a() */
  1106. +     *ptr1++ = val;
  1107. +     l >>= 6;
  1108. +   }
  1109. +   while (ptr1 > buffer)
  1110. +     *ptr2++ = *(--ptr1);
  1111. +   *ptr2 = 0x00;
  1112. +   return(retval);
  1113. + } /* End of l64a() */
  1114. *** /dev/null    Mon Feb 28 07:43:04 1994
  1115. --- labs.c    Mon Feb 28 07:17:38 1994
  1116. ***************
  1117. *** 0 ****
  1118. --- 1,13 ----
  1119. + /* return absolute values */
  1120. + #include <stdlib.h>
  1121. + #ifdef labs
  1122. + #undef labs
  1123. + #endif
  1124. + long
  1125. + labs(x)
  1126. +   long x;
  1127. + {
  1128. +   return x < 0 ? -x : x;
  1129. + }
  1130. *** /dev/null    Mon Feb 28 07:43:04 1994
  1131. --- ldiv.c    Mon Feb 28 05:11:00 1994
  1132. ***************
  1133. *** 0 ****
  1134. --- 1,45 ----
  1135. + /*
  1136. +  * ldiv
  1137. +  *    this one should be compat with -fpcc-struct-return
  1138. +  *
  1139. +  *    ++jrb    bammi@dsrgsun.ces.cwru.edu
  1140. +  */
  1141. + #include <stdlib.h>
  1142. + #ifdef __GNUC__
  1143. + long __divsi3(long, long);    /* returns: quot in d0.l  remainder in d1.l */
  1144. + ldiv_t
  1145. + ldiv(long num, long denom)
  1146. + {
  1147. +     ldiv_t    result;
  1148. +     __asm__ volatile("\
  1149. +          movl    %3,sp@-
  1150. +         movl    %2,sp@-
  1151. +         jsr    ___divsi3
  1152. +         addqw    #8,sp
  1153. +         movl    d0,%0
  1154. +         movl    d1,%1"
  1155. +         : "=g"(result.quot), "=g"(result.rem)
  1156. +         : "r"(num), "r"(denom)
  1157. +         ); /* compiler dependency, dont tell gcc about d0,d1 clobb */
  1158. +     return result;
  1159. + }
  1160. + #else /* !__GNUC__ */
  1161. + ldiv_t
  1162. + ldiv(num, denom)
  1163. + long num, denom;
  1164. + {
  1165. +     ldiv_t res;
  1166. +     
  1167. +     res.quot = num / denom;
  1168. +     res.rem = num % denom;
  1169. +     
  1170. +     return res;
  1171. + }
  1172. + #endif /* !__GNUC__ */
  1173. *** 43.1    1994/02/15 19:34:32
  1174. --- lib.h    1994/02/28 14:01:22
  1175. ***************
  1176. *** 50,55 ****
  1177. --- 50,56 ----
  1178.   #ifdef __MINT__
  1179.   __EXTERN int    _scanf __PROTO((FILE *, int (*)(FILE *),
  1180.               int (*)(int, FILE *), const char *, __VA_LIST__));
  1181. + __EXTERN int    _enoent __PROTO((char *));
  1182.   #endif
  1183.   
  1184.   __EXTERN long        get_sysvar __PROTO((void *var));
  1185. ***************
  1186. *** 116,120 ****
  1187. --- 117,133 ----
  1188.   #define FH_UNKNOWN    0
  1189.   #define FH_ISATTY    1
  1190.   #define FH_ISAFILE    2
  1191. + /*
  1192. +  * macro for converting a long in DOS format to one in Unix format. "x"
  1193. +  * _must_ be an lvalue!
  1194. +  */
  1195. + #define __UNIXTIME(x) (x = _unixtime( ((short *)&x)[0], ((short *)&x)[1] ))
  1196. + __EXTERN int _do_lock __PROTO((int fd, int cmd, long size, int whence));
  1197. + #ifdef _STDIO_H
  1198. + __EXTERN FILE *_fopen_i __PROTO((const char *, const char *, FILE *));
  1199. + #endif
  1200.   
  1201.   #endif /* _LIB_H */
  1202. *** /dev/null    Mon Feb 28 07:43:04 1994
  1203. --- puts.c    Mon Feb 28 06:12:00 1994
  1204. ***************
  1205. *** 0 ****
  1206. --- 1,18 ----
  1207. + /* from Dale Schumacher's dLibs */
  1208. + #include <stdio.h>
  1209. + #include <stddef.h>
  1210. + #include <assert.h>
  1211. + int
  1212. + puts(data)
  1213. +   const char *data;
  1214. + {
  1215. +   register int n;
  1216. +   assert((data != NULL));
  1217. +   if (((n = fputs(data, stdout)) == EOF)
  1218. +       || (fputc('\n', stdout) == EOF))
  1219. +     return (EOF);
  1220. +   return (++n);
  1221. + }
  1222. *** 43.1    1994/02/15 19:34:32
  1223. --- regexp.c    1994/02/24 16:39:52
  1224. ***************
  1225. *** 591,596 ****
  1226. --- 591,597 ----
  1227.   
  1228.     place = opnd;            /* Op node, where operand used to be. */
  1229.     *place++ = op;
  1230. +   *place++ = '\0';
  1231.     *place = '\0';
  1232.   }
  1233.   
  1234. *** /dev/null    Mon Feb 28 07:43:04 1994
  1235. --- rewind.c    Mon Feb 28 06:25:06 1994
  1236. ***************
  1237. *** 0 ****
  1238. --- 1,16 ----
  1239. + /* something like the origonal
  1240. +  * from Dale Schumacher's dLibs
  1241. +  */
  1242. + #include <stdio.h>
  1243. + #include <unistd.h>
  1244. + void
  1245. + rewind(fp)
  1246. +   register FILE *fp;
  1247. + {
  1248. +   fflush(fp);
  1249. +   (void) lseek(fp->_file, 0L, SEEK_SET);
  1250. +   fp->_flag &= ~(_IOEOF|_IOERR);
  1251. + }
  1252. *** /dev/null    Mon Feb 28 07:43:04 1994
  1253. --- setegid.c    Mon Feb 28 07:00:42 1994
  1254. ***************
  1255. *** 0 ****
  1256. --- 1,8 ----
  1257. + #include <unistd.h>
  1258. + int
  1259. + setegid(x)
  1260. +   int x;
  1261. + {
  1262. +   return setgid(x);
  1263. + }
  1264. *** /dev/null    Mon Feb 28 07:43:04 1994
  1265. --- seteuid.c    Mon Feb 28 06:59:24 1994
  1266. ***************
  1267. *** 0 ****
  1268. --- 1,8 ----
  1269. + #include <unistd.h>
  1270. + int
  1271. + seteuid(x)
  1272. +   int x;
  1273. + {
  1274. +   return setuid(x);
  1275. + }
  1276. *** /dev/null    Mon Feb 28 07:43:04 1994
  1277. --- setgid.c    Mon Feb 28 07:05:22 1994
  1278. ***************
  1279. *** 0 ****
  1280. --- 1,27 ----
  1281. + #include <types.h>
  1282. + #include <unistd.h>
  1283. + #include <osbind.h>
  1284. + #include <mintbind.h>
  1285. + #include <errno.h>
  1286. + extern int __mint;
  1287. + extern gid_t __gid;
  1288. + int
  1289. + setgid(x)
  1290. +   int x;
  1291. + {
  1292. +   long r;
  1293. +   if (__mint) {
  1294. +     r = Psetgid(x);
  1295. +     if (r < 0) {
  1296. +       errno = (int) -r;
  1297. +       return -1;
  1298. +     }
  1299. +     return 0;
  1300. +   }
  1301. +   __gid = x;
  1302. +   return 0;
  1303. + }
  1304. *** /dev/null    Mon Feb 28 07:43:04 1994
  1305. --- setregid.c    Mon Feb 28 06:58:10 1994
  1306. ***************
  1307. *** 0 ****
  1308. --- 1,9 ----
  1309. + #include <unistd.h>
  1310. + int
  1311. + setregid(rgid,egid)
  1312. +   int rgid, egid;
  1313. + {
  1314. +   return setgid(egid);
  1315. + }
  1316. *** /dev/null    Mon Feb 28 07:43:04 1994
  1317. --- setreuid.c    Mon Feb 28 06:58:34 1994
  1318. ***************
  1319. *** 0 ****
  1320. --- 1,9 ----
  1321. + #include <unistd.h>
  1322. + int
  1323. + setreuid(ruid,euid)
  1324. +   int ruid, euid;
  1325. + {
  1326. +   return setuid(euid);
  1327. + }
  1328. *** /dev/null    Mon Feb 28 07:43:04 1994
  1329. --- setuid.c    Mon Feb 28 07:04:32 1994
  1330. ***************
  1331. *** 0 ****
  1332. --- 1,26 ----
  1333. + #include <types.h>
  1334. + #include <unistd.h>
  1335. + #include <osbind.h>
  1336. + #include <mintbind.h>
  1337. + #include <errno.h>
  1338. + extern int __mint;
  1339. + extern uid_t __uid;
  1340. + int
  1341. + setuid(x)
  1342. +   int x;
  1343. + {
  1344. +   long r;
  1345. +   if (__mint) {
  1346. +     r = Psetuid(x);
  1347. +     if (r < 0) {
  1348. +       errno = (int) -r;
  1349. +       return -1;
  1350. +     }
  1351. +     return 0;
  1352. +   }
  1353. +   __uid = x;
  1354. +   return 0;
  1355. + }
  1356. *** /dev/null    Mon Feb 28 07:43:04 1994
  1357. --- uidgid.c    Mon Feb 28 06:50:42 1994
  1358. ***************
  1359. *** 0 ****
  1360. --- 1,5 ----
  1361. + #include <types.h>
  1362. + uid_t __uid = 0;
  1363. + gid_t __gid = 0;
  1364. *** 43.1    1994/02/15 19:34:32
  1365. --- Bugs    1994/02/27 12:49:50
  1366. ***************
  1367. *** 39,50 ****
  1368.     definitions from the include file.  That should be easier to track down
  1369.     than a hung compiler, at least. -entropy]
  1370.   
  1371. - abort.c: ++entropy
  1372. -   If my understanding is correct, abort() should unmask SIGABRT, and also
  1373. -   set SIGABRT's signal handler to SIG_DFL if it was SIG_IGN, before raising
  1374. -   the signal.  Would someone with a copy of the POSIX spec please look into
  1375. -   this?
  1376.   access.c: ++entropy
  1377.     I think my "superuser can access anything" assumption is wrong, especially
  1378.     if checking execute permissions.
  1379. --- 39,44 ----
  1380. ***************
  1381. *** 150,160 ****
  1382.   open.c: ++nox
  1383.     Should open() do a TIOCSPGRP too when it Fforces the control tty?
  1384.     I think, but i'm not 100% sure...
  1385. !   Currently errno is set to EPATH (ENOTDIR) in some cases where UNIX would
  1386. !   give EFILNF (ENOENT).  The GEMDOS error codes should be translated by the
  1387. !   library in these cases.  This affects open() and creat(), and possibly
  1388. !   other functions as well (check access(),  unlink(), mkdir(), anything that
  1389. !   accesses files by name).
  1390.   
  1391.   pgrp.c: ++entropy
  1392.     The setsid() function never really disassociates the controlling tty from
  1393. --- 144,150 ----
  1394.   open.c: ++nox
  1395.     Should open() do a TIOCSPGRP too when it Fforces the control tty?
  1396.     I think, but i'm not 100% sure...
  1397. !   [The kernel does this for us automagically. -entropy]
  1398.   
  1399.   pgrp.c: ++entropy
  1400.     The setsid() function never really disassociates the controlling tty from
  1401. ***************
  1402. *** 177,187 ****
  1403.   scanf.c: ++jrb
  1404.     Evidently loses big time.  Run Gcctests and find out what's what.
  1405.   
  1406. ! sigactio.c: ++nox@jelal.north.de, ++entropy
  1407. !   sigblock() could be declared int at least #ifndef __MSHORT__.  The
  1408. !   functions sigpending(), sigprocmask(), and sigsuspend() have not been
  1409. !   tested.  The other new POSIX sig*() functions have been tested but not
  1410. !   exhaustively.
  1411.   
  1412.   sleep.c: ++boender, ++entropy
  1413.     sleep() will never sleep for more than LONG_MAX / 1000 (approximately 2
  1414. --- 167,177 ----
  1415.   scanf.c: ++jrb
  1416.     Evidently loses big time.  Run Gcctests and find out what's what.
  1417.   
  1418. ! sigactio.c, sigblock.c: ++nox@jelal.north.de, ++entropy
  1419. !   sigblock() and sigsetmask() could be declared int at least #ifndef
  1420. !   __MSHORT__.  The functions sigpending(), sigprocmask(), and sigsuspend()
  1421. !   have not been tested.  The other new POSIX sig*() functions have been
  1422. !   tested but not exhaustively.
  1423.   
  1424.   sleep.c: ++boender, ++entropy
  1425.     sleep() will never sleep for more than LONG_MAX / 1000 (approximately 2
  1426. ***************
  1427. *** 226,231 ****
  1428. --- 216,223 ----
  1429.     tfork() doesn't know about -mbaserel, had to save a4 (base pointer)
  1430.     myself for the child.  (and all this only because we still don't have a
  1431.     real vfork...)
  1432. +   [There's now some code that may fix this, but I've only tested it
  1433. +   briefly. -entropy]
  1434.   
  1435.   types.h: ++entropy
  1436.     Need ssize_t for POSIX compliance.
  1437. *** 43.1    1994/02/15 19:34:32
  1438. --- Changelog    1994/03/01 05:05:10
  1439. ***************
  1440. *** 4,9 ****
  1441. --- 4,605 ----
  1442.   Changes are listed in *reverse* order, most recent changes being
  1443.   first.
  1444.   
  1445. + PATCHLEVEL44::
  1446. + ***** a64l.c
  1447. + ----------------------------
  1448. + revision 43.2    
  1449. + date: 1994/02/28 13:27:40;  author: entropy;  state: Exp;  lines: +0 -49
  1450. + broke out functions
  1451. + =============================================================================
  1452. + ***** abort.c
  1453. + ----------------------------
  1454. + revision 43.2    
  1455. + date: 1994/02/27 13:16:42;  author: entropy;  state: Exp;  lines: +9 -7
  1456. + A possibly more ANSI/POSIX compliant abort().
  1457. + =============================================================================
  1458. + ***** abs.c
  1459. + ----------------------------
  1460. + revision 43.2    
  1461. + date: 1994/02/28 13:33:08;  author: entropy;  state: Exp;  lines: +4 -9
  1462. + broke out functions
  1463. + =============================================================================
  1464. + ***** atoi.c
  1465. + ----------------------------
  1466. + revision 43.2    
  1467. + date: 1994/02/28 13:33:32;  author: entropy;  state: Exp;
  1468. + NEW file, broken out from atol.c
  1469. + =============================================================================
  1470. + ***** atol.c
  1471. + ----------------------------
  1472. + revision 43.2    
  1473. + date: 1994/02/28 13:34:10;  author: entropy;  state: Exp;  lines: +2 -8
  1474. + broke out functions
  1475. + =============================================================================
  1476. + ***** chmod.c
  1477. + ----------------------------
  1478. + revision 43.2    
  1479. + date: 1994/02/28 13:36:30;  author: entropy;  state: Exp;  lines: +2 -24
  1480. + broke out functions
  1481. + =============================================================================
  1482. + ***** chown.c
  1483. + ----------------------------
  1484. + revision 43.2    
  1485. + date: 1994/02/28 18:37:20;  author: entropy;  state: Exp;
  1486. + NEW file, broken out from chmod.c
  1487. + =============================================================================
  1488. + ***** div.c
  1489. + ----------------------------
  1490. + revision 43.2    
  1491. + date: 1994/02/28 13:36:30;  author: entropy;  state: Exp;  lines: +3 -32
  1492. + broke out functions
  1493. + =============================================================================
  1494. + ***** fgetpos.c
  1495. + ----------------------------
  1496. + revision 43.2    
  1497. + date: 1994/02/28 13:50:12;  author: entropy;  state: Exp;
  1498. + NEW file, broken out from fsetpos.c
  1499. + =============================================================================
  1500. + ***** fopen.c
  1501. + ----------------------------
  1502. + revision 43.2    
  1503. + date: 1994/02/28 13:36:30;  author: entropy;  state: Exp;  lines: +20 -146
  1504. + broke out functions
  1505. + =============================================================================
  1506. + ***** fopen_i.c
  1507. + ----------------------------
  1508. + revision 43.2    
  1509. + date: 1994/02/28 13:46:12;  author: entropy;  state: Exp;
  1510. + NEW file, broken out from fopen.c
  1511. + =============================================================================
  1512. + ***** fputs.c
  1513. + ----------------------------
  1514. + revision 43.2    
  1515. + date: 1994/02/28 13:36:30;  author: entropy;  state: Exp;  lines: +15 -26
  1516. + broke out functions
  1517. + =============================================================================
  1518. + ***** freopen.c
  1519. + ----------------------------
  1520. + revision 43.2    
  1521. + date: 1994/02/28 13:46:12;  author: entropy;  state: Exp;
  1522. + NEW file, broken out from fopen.c
  1523. + =============================================================================
  1524. + ***** fseek.c
  1525. + ----------------------------
  1526. + revision 43.2    
  1527. + date: 1994/02/28 13:36:30;  author: entropy;  state: Exp;  lines: +5 -41
  1528. + broke out functions
  1529. + =============================================================================
  1530. + ***** fsetpos.c
  1531. + ----------------------------
  1532. + revision 43.2    
  1533. + date: 1994/02/28 13:36:30;  author: entropy;  state: Exp;  lines: +17 -33
  1534. + broke out functions
  1535. + =============================================================================
  1536. + ***** ftell.c
  1537. + ----------------------------
  1538. + revision 43.2    
  1539. + date: 1994/02/28 13:49:16;  author: entropy;  state: Exp;
  1540. + NEW file, broken out from fseek.c
  1541. + =============================================================================
  1542. + ***** getegid.c
  1543. + ----------------------------
  1544. + revision 43.2    
  1545. + date: 1994/02/28 13:52:34;  author: entropy;  state: Exp;
  1546. + NEW file, broken out from getuid.c
  1547. + =============================================================================
  1548. + ***** geteuid.c
  1549. + ----------------------------
  1550. + revision 43.2    
  1551. + date: 1994/02/28 13:52:34;  author: entropy;  state: Exp;
  1552. + NEW file, broken out from getuid.c
  1553. + =============================================================================
  1554. + ***** getgid.c
  1555. + ----------------------------
  1556. + revision 43.2    
  1557. + date: 1994/02/28 13:52:34;  author: entropy;  state: Exp;
  1558. + NEW file, broken out from getuid.c
  1559. + =============================================================================
  1560. + ***** getpid.c
  1561. + ----------------------------
  1562. + revision 43.2    
  1563. + date: 1994/02/28 13:36:30;  author: entropy;  state: Exp;  lines: +5 -2
  1564. + broke out functions
  1565. + =============================================================================
  1566. + ***** getppid.c
  1567. + ----------------------------
  1568. + revision 43.2    
  1569. + date: 1994/02/28 13:50:12;  author: entropy;  state: Exp;
  1570. + NEW file, broken out from getpid.c
  1571. + =============================================================================
  1572. + ***** getuid.c
  1573. + ----------------------------
  1574. + revision 43.2    
  1575. + date: 1994/02/28 13:36:30;  author: entropy;  state: Exp;  lines: +5 -63
  1576. + broke out functions
  1577. + =============================================================================
  1578. + ***** l64a.c
  1579. + ----------------------------
  1580. + revision 43.2    
  1581. + date: 1994/02/28 13:27:04;  author: entropy;  state: Exp;
  1582. + NEW file, broke out from a64l.c.
  1583. + =============================================================================
  1584. + ***** labs.c
  1585. + ----------------------------
  1586. + revision 43.2    
  1587. + date: 1994/02/28 13:28:50;  author: entropy;  state: Exp;
  1588. + NEW file, formerly in abs.c
  1589. + =============================================================================
  1590. + ***** ldiv.c
  1591. + ----------------------------
  1592. + revision 43.2    
  1593. + date: 1994/02/28 13:42:52;  author: entropy;  state: Exp;
  1594. + NEW file, broken out from div.c
  1595. + =============================================================================
  1596. + ***** lib.h
  1597. + ----------------------------
  1598. + revision 43.3    
  1599. + date: 1994/02/28 14:03:04;  author: entropy;  state: Exp;  lines: +12 -0
  1600. + add some prototypes
  1601. + ----------------------------
  1602. + revision 43.2
  1603. + date: 1994/02/27 11:51:30;  author: entropy;  state: Exp;  lines: +1 -0
  1604. + add _enoent() prototype.
  1605. + =============================================================================
  1606. + ***** puts.c
  1607. + ----------------------------
  1608. + revision 43.2    
  1609. + date: 1994/02/28 13:47:38;  author: entropy;  state: Exp;
  1610. + NEW file, broken out from fputs.c
  1611. + =============================================================================
  1612. + ***** regexp.c
  1613. + ----------------------------
  1614. + revision 43.2    
  1615. + date: 1994/02/24 16:41:16;  author: schwab;  state: Exp;  lines: +1 -0
  1616. + regcomp fails to compile "(a+|b)*" (from libtest/tregex.c).  The bug
  1617. + is an uninitialized byte in reginsert.
  1618. + =============================================================================
  1619. + ***** rewind.c
  1620. + ----------------------------
  1621. + revision 43.2    
  1622. + date: 1994/02/28 13:49:16;  author: entropy;  state: Exp;
  1623. + NEW file, broken out from fseek.c
  1624. + =============================================================================
  1625. + ***** setegid.c
  1626. + ----------------------------
  1627. + revision 43.2    
  1628. + date: 1994/02/28 13:52:34;  author: entropy;  state: Exp;
  1629. + NEW file, broken out from getuid.c
  1630. + =============================================================================
  1631. + ***** seteuid.c
  1632. + ----------------------------
  1633. + revision 43.2    
  1634. + date: 1994/02/28 13:52:34;  author: entropy;  state: Exp;
  1635. + NEW file, broken out from getuid.c
  1636. + =============================================================================
  1637. + ***** setgid.c
  1638. + ----------------------------
  1639. + revision 43.2    
  1640. + date: 1994/02/28 13:52:34;  author: entropy;  state: Exp;
  1641. + NEW file, broken out from getuid.c
  1642. + =============================================================================
  1643. + ***** setregid.c
  1644. + ----------------------------
  1645. + revision 43.2    
  1646. + date: 1994/02/28 13:52:34;  author: entropy;  state: Exp;
  1647. + NEW file, broken out from getuid.c
  1648. + =============================================================================
  1649. + ***** setreuid.c
  1650. + ----------------------------
  1651. + revision 43.2    
  1652. + date: 1994/02/28 13:52:34;  author: entropy;  state: Exp;
  1653. + NEW file, broken out from getuid.c
  1654. + =============================================================================
  1655. + ***** setuid.c
  1656. + ----------------------------
  1657. + revision 43.2    
  1658. + date: 1994/02/28 13:52:34;  author: entropy;  state: Exp;
  1659. + NEW file, broken out from getuid.c
  1660. + =============================================================================
  1661. + ***** uidgid.c
  1662. + ----------------------------
  1663. + revision 43.2    
  1664. + date: 1994/02/28 13:52:34;  author: entropy;  state: Exp;
  1665. + NEW file, broken out from getuid.c
  1666. + =============================================================================
  1667. + ***** include/PatchLev.h
  1668. + ----------------------------
  1669. + revision 43.2    
  1670. + date: 1994/02/15 20:33:52;  author: entropy;  state: Exp;  lines: +1 -1
  1671. + -
  1672. + =============================================================================
  1673. + ***** include/ioctl.h
  1674. + ----------------------------
  1675. + revision 43.5    
  1676. + date: 1994/02/27 09:42:40;  author: entropy;  state: Exp;  lines: +13 -8
  1677. + Add some more TIOCM_* definitions
  1678. + ----------------------------
  1679. + revision 43.4
  1680. + date: 1994/02/21 19:31:36;  author: entropy;  state: Exp;  lines: +29 -0
  1681. + Catch up with MiNT's file.h:  Add cursor ioctl's and some missing
  1682. + process ioctl's.
  1683. + ----------------------------
  1684. + revision 43.3
  1685. + date: 1994/02/21 19:20:24;  author: entropy;  state: Exp;  lines: +9 -0
  1686. + Add TIOCMGET (faked) and related bitmasks.
  1687. + ----------------------------
  1688. + revision 43.2
  1689. + date: 1994/02/19 14:25:04;  author: entropy;  state: Exp;  lines: +11 -9
  1690. + Added TIOCSDTR, TIOCCDTR and cleaned up a bit.
  1691. + =============================================================================
  1692. + ***** include/mintbind.h
  1693. + ----------------------------
  1694. + revision 43.2    
  1695. + date: 1994/02/26 08:45:42;  author: entropy;  state: Exp;  lines: +8 -0
  1696. + Add new MiNT system calls: Tmalarm(), Psigintr(), Suptime().
  1697. + All are unofficial and subject to change.
  1698. + =============================================================================
  1699. + ***** include/ostruct.h
  1700. + ----------------------------
  1701. + revision 43.2    
  1702. + date: 1994/02/22 17:47:58;  author: entropy;  state: Exp;  lines: +4 -0
  1703. + Complete the _PARAM structure used with Initmous().
  1704. + =============================================================================
  1705. + ***** cfgetisp.c
  1706. + ----------------------------
  1707. + revision 43.2    
  1708. + date: 1994/02/28 13:38:48;  author: entropy;  state: Exp;
  1709. + NEW file, previously in cfspeed.c
  1710. + =============================================================================
  1711. + ***** cfgetosp.c
  1712. + ----------------------------
  1713. + revision 43.2    
  1714. + date: 1994/02/28 13:38:48;  author: entropy;  state: Exp;
  1715. + NEW file, previously in cfspeed.c
  1716. + =============================================================================
  1717. + ***** cfsetisp.c
  1718. + ----------------------------
  1719. + revision 43.2    
  1720. + date: 1994/02/28 13:38:48;  author: entropy;  state: Exp;
  1721. + NEW file, previously in cfspeed.c
  1722. + =============================================================================
  1723. + ***** cfsetosp.c
  1724. + ----------------------------
  1725. + revision 43.2    
  1726. + date: 1994/02/28 13:38:48;  author: entropy;  state: Exp;
  1727. + NEW file, previously in cfspeed.c
  1728. + =============================================================================
  1729. + ***** closedir.c
  1730. + ----------------------------
  1731. + revision 43.2    
  1732. + date: 1994/02/28 13:41:04;  author: entropy;  state: Exp;
  1733. + NEW file, broken out from dirent.c
  1734. + =============================================================================
  1735. + ***** do_lock.c
  1736. + ----------------------------
  1737. + revision 43.2    
  1738. + date: 1994/02/28 13:55:50;  author: entropy;  state: Exp;
  1739. + NEW file, broken out from lockf.c
  1740. + =============================================================================
  1741. + ***** do_stat.c
  1742. + ----------------------------
  1743. + revision 43.3    
  1744. + date: 1994/02/28 14:42:02;  author: entropy;  state: Exp;  lines: +2 -0
  1745. + *** empty log message ***
  1746. + ----------------------------
  1747. + revision 43.2
  1748. + date: 1994/02/28 13:24:18;  author: entropy;  state: Exp;
  1749. + NEW file, broken out from stat.c
  1750. + =============================================================================
  1751. + ***** dup.c
  1752. + ----------------------------
  1753. + revision 43.2    
  1754. + date: 1994/02/28 13:36:30;  author: entropy;  state: Exp;  lines: +2 -26
  1755. + broke out functions
  1756. + =============================================================================
  1757. + ***** dup2.c
  1758. + ----------------------------
  1759. + revision 43.2    
  1760. + date: 1994/02/28 13:42:52;  author: entropy;  state: Exp;
  1761. + NEW file, broke out from dup.c
  1762. + =============================================================================
  1763. + ***** enoent.c
  1764. + ----------------------------
  1765. + revision 43.4    
  1766. + date: 1994/02/28 08:40:02;  author: entropy;  state: Exp;  lines: +1 -1
  1767. + Fix Fxattr() call (0 == follow links).
  1768. + ----------------------------
  1769. + revision 43.3
  1770. + date: 1994/02/28 02:04:10;  author: entropy;  state: Exp;  lines: +7 -1
  1771. + block signals during critical portions of the code.
  1772. + ----------------------------
  1773. + revision 43.2
  1774. + date: 1994/02/27 11:46:50;  author: entropy;  state: Exp;
  1775. + NEW file:  function to determine if an error should have been ENOENT
  1776. + instead of ENOTDIR (UNIX and GEMDOS have different ideas on this).
  1777. + =============================================================================
  1778. + ***** execl.c
  1779. + ----------------------------
  1780. + revision 43.2    
  1781. + date: 1994/02/28 13:44:34;  author: entropy;  state: Exp;
  1782. + NEW file, broken out from exec.c
  1783. + =============================================================================
  1784. + ***** execle.c
  1785. + ----------------------------
  1786. + revision 43.2    
  1787. + date: 1994/02/28 13:44:34;  author: entropy;  state: Exp;
  1788. + NEW file, broken out from exec.c
  1789. + =============================================================================
  1790. + ***** execv.c
  1791. + ----------------------------
  1792. + revision 43.2    
  1793. + date: 1994/02/28 13:44:34;  author: entropy;  state: Exp;
  1794. + NEW file, broken out from exec.c
  1795. + =============================================================================
  1796. + ***** execve.c
  1797. + ----------------------------
  1798. + revision 43.2    
  1799. + date: 1994/02/28 13:44:34;  author: entropy;  state: Exp;
  1800. + NEW file, broken out from exec.c
  1801. + =============================================================================
  1802. + ***** flock.c
  1803. + ----------------------------
  1804. + revision 43.2    
  1805. + date: 1994/02/28 13:55:50;  author: entropy;  state: Exp;
  1806. + NEW file, broken out from lockf.c
  1807. + =============================================================================
  1808. + ***** fscanf.c
  1809. + ----------------------------
  1810. + revision 43.2    
  1811. + date: 1994/02/28 13:36:30;  author: entropy;  state: Exp;  lines: +0 -17
  1812. + broke out functions
  1813. + =============================================================================
  1814. + ***** fstat.c
  1815. + ----------------------------
  1816. + revision 43.3    
  1817. + date: 1994/02/28 14:02:36;  author: entropy;  state: Exp;  lines: +2 -0
  1818. + *** empty log message ***
  1819. + ----------------------------
  1820. + revision 43.2
  1821. + date: 1994/02/28 13:24:18;  author: entropy;  state: Exp;
  1822. + NEW file broken out from stat.c
  1823. + =============================================================================
  1824. + ***** getcwd.c
  1825. + ----------------------------
  1826. + revision 43.2    
  1827. + date: 1994/02/28 13:36:30;  author: entropy;  state: Exp;  lines: +0 -13
  1828. + broke out functions
  1829. + =============================================================================
  1830. + ***** getgroup.c
  1831. + ----------------------------
  1832. + revision 43.2    
  1833. + date: 1994/02/28 11:38:48;  author: entropy;  state: Exp;  lines: +0 -26
  1834. + Stripped out RCS header.
  1835. + =============================================================================
  1836. + ***** getwd.c
  1837. + ----------------------------
  1838. + revision 43.3    
  1839. + date: 1994/02/28 14:55:16;  author: entropy;  state: Exp;  lines: +1 -0
  1840. + *** empty log message ***
  1841. + ----------------------------
  1842. + revision 43.2
  1843. + date: 1994/02/28 13:50:12;  author: entropy;  state: Exp;
  1844. + NEW file, broken out from getcwd.c
  1845. + =============================================================================
  1846. + ***** inode.c
  1847. + ----------------------------
  1848. + revision 43.2    
  1849. + date: 1994/02/28 13:24:18;  author: entropy;  state: Exp;
  1850. + NEW file, broken out from stat.c
  1851. + =============================================================================
  1852. + ***** ioctl.c
  1853. + ----------------------------
  1854. + revision 43.4    
  1855. + date: 1994/02/21 19:20:52;  author: entropy;  state: Exp;  lines: +62 -27
  1856. + Add TIOCMGET (only works on /dev/modem1, requires MiNT 1.10
  1857. + (needs valid st_rdev from FSTAT).
  1858. + ----------------------------
  1859. + revision 43.3
  1860. + date: 1994/02/19 15:05:00;  author: entropy;  state: Exp;  lines: +76 -57
  1861. + Use switch instead of cascading if's.
  1862. + ----------------------------
  1863. + revision 43.2
  1864. + date: 1994/02/19 14:41:50;  author: entropy;  state: Exp;  lines: +24 -0
  1865. + Add TIOCCDTR and TIOCSDTR.
  1866. + =============================================================================
  1867. + ***** isatty.c
  1868. + ----------------------------
  1869. + revision 43.3    
  1870. + date: 1994/02/28 15:00:50;  author: entropy;  state: Exp;  lines: +1 -0
  1871. + *** empty log message ***
  1872. + ----------------------------
  1873. + revision 43.2
  1874. + date: 1994/02/28 13:36:30;  author: entropy;  state: Exp;  lines: +3 -44
  1875. + broke out functions
  1876. + =============================================================================
  1877. + ***** isctty.c
  1878. + ----------------------------
  1879. + revision 43.2    
  1880. + date: 1994/02/28 13:55:16;  author: entropy;  state: Exp;
  1881. + NEW file, broken out from isatty.c
  1882. + =============================================================================
  1883. + ***** lockf.c
  1884. + ----------------------------
  1885. + revision 43.2    
  1886. + date: 1994/02/28 13:36:30;  author: entropy;  state: Exp;  lines: +3 -79
  1887. + broke out functions
  1888. + =============================================================================
  1889. + ***** lstat.c
  1890. + ----------------------------
  1891. + revision 43.3    
  1892. + date: 1994/02/28 14:02:36;  author: entropy;  state: Exp;  lines: +2 -0
  1893. + *** empty log message ***
  1894. + ----------------------------
  1895. + revision 43.2
  1896. + date: 1994/02/28 13:24:18;  author: entropy;  state: Exp;
  1897. + NEW file, broken out from stat.c
  1898. + =============================================================================
  1899. + ***** mincl
  1900. + ----------------------------
  1901. + revision 43.3    
  1902. + date: 1994/02/28 19:38:04;  author: entropy;  state: Exp;  lines: +34 -18
  1903. + *** empty log message ***
  1904. + ----------------------------
  1905. + revision 43.2
  1906. + date: 1994/02/28 02:00:32;  author: entropy;  state: Exp;  lines: +1 -0
  1907. + *** empty log message ***
  1908. + =============================================================================
  1909. + ***** open.c
  1910. + ----------------------------
  1911. + revision 43.3    
  1912. + date: 1994/02/27 14:08:02;  author: entropy;  state: Exp;  lines: +1 -1
  1913. + *** empty log message ***
  1914. + ----------------------------
  1915. + revision 43.2
  1916. + date: 1994/02/27 12:04:08;  author: entropy;  state: Exp;  lines: +3 -1
  1917. + do _enoent() conversion.
  1918. + =============================================================================
  1919. + ***** opendir.c
  1920. + ----------------------------
  1921. + revision 43.2    
  1922. + date: 1994/02/28 13:41:04;  author: entropy;  state: Exp;
  1923. + NEW file, broken out from dirent.c
  1924. + =============================================================================
  1925. + ***** readdir.c
  1926. + ----------------------------
  1927. + revision 43.2    
  1928. + date: 1994/02/28 13:41:04;  author: entropy;  state: Exp;
  1929. + NEW file, broken out from dirent.c
  1930. + =============================================================================
  1931. + ***** rewinddi.c
  1932. + ----------------------------
  1933. + revision 43.2    
  1934. + date: 1994/02/28 13:41:04;  author: entropy;  state: Exp;
  1935. + NEW file, broken out from dirent.c
  1936. + =============================================================================
  1937. + ***** scanf.c
  1938. + ----------------------------
  1939. + revision 43.2    
  1940. + date: 1994/02/24 16:44:30;  author: schwab;  state: Exp;  lines: +6 -1
  1941. + With the last change in scanf.c i have introduced a new bug: now
  1942. + sscanf("0", "%x", &i) fails!
  1943. + =============================================================================
  1944. + ***** seekdir.c
  1945. + ----------------------------
  1946. + revision 43.2    
  1947. + date: 1994/02/28 13:41:04;  author: entropy;  state: Exp;
  1948. + NEW file, broken out from dirent.c
  1949. + =============================================================================
  1950. + ***** stat.c
  1951. + ----------------------------
  1952. + revision 43.4    
  1953. + date: 1994/02/28 15:34:16;  author: entropy;  state: Exp;  lines: +2 -0
  1954. + *** empty log message ***
  1955. + ----------------------------
  1956. + revision 43.3
  1957. + date: 1994/02/28 13:26:12;  author: entropy;  state: Exp;  lines: +1 -326
  1958. + broke out functions
  1959. + ----------------------------
  1960. + revision 43.2
  1961. + date: 1994/02/27 11:51:00;  author: entropy;  state: Exp;  lines: +3 -0
  1962. + do _enoent() translation.
  1963. + =============================================================================
  1964. + ***** sync.c
  1965. + ----------------------------
  1966. + revision 43.3    
  1967. + date: 1994/02/28 02:19:50;  author: entropy;  state: Exp;  lines: +1 -0
  1968. + Include <string.h> for strcpy() prototype.
  1969. + ----------------------------
  1970. + revision 43.2
  1971. + date: 1994/02/19 12:57:34;  author: dsb;  state: Exp;  lines: +12 -6
  1972. + Fix for sozobon compatibility.
  1973. + =============================================================================
  1974. + ***** tcdrain.c
  1975. + ----------------------------
  1976. + revision 43.2    
  1977. + date: 1994/02/19 13:07:18;  author: entropy;  state: Exp;  lines: +22 -3
  1978. + A better tcdrain() using TIOCOUTQ in MiNT 1.10.
  1979. + =============================================================================
  1980. + ***** tcflush.c
  1981. + ----------------------------
  1982. + revision 43.2    
  1983. + date: 1994/02/19 12:23:38;  author: entropy;  state: Exp;  lines: +1 -1
  1984. + Bug fix: specify the *address* of the bitmask of the type of flush,
  1985. + not the bitmask itself.
  1986. + =============================================================================
  1987. + ***** telldir.c
  1988. + ----------------------------
  1989. + revision 43.2    
  1990. + date: 1994/02/28 13:41:04;  author: entropy;  state: Exp;
  1991. + NEW file, broken out from dirent.c
  1992. + =============================================================================
  1993. + ***** unlink.c
  1994. + ----------------------------
  1995. + revision 43.2    
  1996. + date: 1994/02/27 11:56:12;  author: entropy;  state: Exp;  lines: +2 -0
  1997. + do _enoent() conversion.
  1998. + =============================================================================
  1999. + ***** vfscanf.c
  2000. + ----------------------------
  2001. + revision 43.2    
  2002. + date: 1994/02/28 13:48:16;  author: entropy;  state: Exp;
  2003. + NEW file, broken out from fscanf.c
  2004. + =============================================================================
  2005. + ***** vscanf.c
  2006. + ----------------------------
  2007. + revision 43.2    
  2008. + date: 1994/02/28 13:48:16;  author: entropy;  state: Exp;
  2009. + NEW file, broken out from fscanf.c
  2010. + =============================================================================
  2011. + ***** purec/Makefile
  2012. + ----------------------------
  2013. + revision 43.2    
  2014. + date: 1994/02/28 17:59:16;  author: entropy;  state: Exp;  lines: +32 -18
  2015. + Add new targets.
  2016. + =============================================================================
  2017. + ***** purec/mintlib.prj
  2018. + ----------------------------
  2019. + revision 43.2    
  2020. + date: 1994/02/28 18:13:42;  author: entropy;  state: Exp;  lines: +46 -3
  2021. + Add new targets.
  2022. + =============================================================================
  2023. + ***** sozobon/makefile
  2024. + ----------------------------
  2025. + revision 43.3    
  2026. + date: 1994/02/28 17:41:18;  author: entropy;  state: Exp;  lines: +45 -32
  2027. + add new targets
  2028. + ----------------------------
  2029. + revision 43.2
  2030. + date: 1994/02/19 12:58:24;  author: dsb;  state: Exp;  lines: +28 -13
  2031. + Updated for PL43.
  2032. + =============================================================================
  2033. + ***** sozobon/readme
  2034. + ----------------------------
  2035. + revision 43.2    
  2036. + date: 1994/02/19 12:58:44;  author: dsb;  state: Exp;  lines: +7 -10
  2037. + Updated for PL43.
  2038. + =============================================================================
  2039.   PATCHLEVEL43::
  2040.   
  2041.   ***** libgcc2.c
  2042. *** 43.1    1994/02/15 19:34:32
  2043. --- Files    1994/02/28 13:22:14
  2044. ***************
  2045. *** 6,59 ****
  2046.   _mulsf3.cpp   _mulsi3.s        _negdf2.s      _negsf2.s    _normdf.cpp \
  2047.   _normsf.cpp   _truncdf.cpp  _udivmod.s      _umulsi3.s    a64l.c \
  2048.   abort.c          abs.c        access.c      alglobal.c    alloca.cpp \
  2049. ! alphasor.c    atof.c        atol.c      bblink.c    bcmp.c \
  2050. ! bcopy.cpp     binmode.c        bsearch.c      buffindf.c    bzero.cpp \
  2051. ! calloc.c      chdir.c        chmod.c      ctermid.c    ctime.c \
  2052. ! ctype.c          cuserid.c        defmode.c      difftime.c    div.c \
  2053. ! div.cpp          doprnt.c        eprintf.c      errbase.h    fclose.c \
  2054. ! fdopen.c      fflush.c        ffs.c      fgetc.c    fgets.c \
  2055. ! filbuf.c      findfile.c    flonum.h      fopen.c    fprintf.c \
  2056. ! fputc.c          fputs.c        fread.c      frexp.cpp    frwbin.c \
  2057. ! fseek.c          fsetpos.c        ftw.c      fungetc.c    fwrite.c \
  2058. ! gbl-ctors.h   getbuf.c        getenv.c      getlogin.c    getopt.c \
  2059. ! getpass.c     getpid.c        getpw.c      gets.c    getuid.c \
  2060.   getw.c          gmon.c        gnulib2.c      grp.c        ic.c \
  2061. ! ig.c          il.c        ip.c      iw.c        ldexp.cpp \
  2062. ! lib.h          libgcc1.c        libgcc2.c      linea.c    localtim.c \
  2063. ! longlong.h    lseek.c        ltoa.c      malloc.c    memccpy.c \
  2064. ! memchr.c      memcmp.c        mktemp.c      modf.cpp    nlist.c \
  2065. ! obstack.c     perror.c        pgrp.c      printf.c    psignal.c \
  2066. ! putenv.c      qsort.c        raise.c      rand.c    random.c \
  2067. ! realloc.c     regexp.c        regsup.c      sbrk.c    setbuf.c \
  2068. ! setjmp.cpp    setlocal.c    setvbuf.c      sgtty.c    siglist.c \
  2069. ! sprintf.c     stksiz.c        strcat.c      strchr.c    strcmp.c \
  2070. ! strcoll.c     strcpy.c        strcspn.c      strdup.c    strerror.c \
  2071. ! strftime.c    stricmp.c        strlen.c      strlwr.c    strncat.c \
  2072. ! strncmp.c     strncpy.c        strnicmp.c      strpbrk.c    strrchr.c \
  2073. ! strrev.c      strspn.c        strstr.c      strtok.c    strtol.c \
  2074. ! strtoul.c     strupr.c        system.c      sysvar.c    textio.c \
  2075. ! time.c          timeoday.c    tmpfile.c      tmpnam.c    toxxx.c \
  2076. ! utime.c          vfprintf.c    vprintf.c      wcmb.c    wcscat.c \
  2077. ! wcscmp.c      wcscpy.c        wcslen.c      wnull.c \
  2078.   
  2079.   MINTLIB= \
  2080. ! Makefile      alarm.c        atexit.c      cfspeed.c    clock.c \
  2081. ! close.c          console.c        crt0.cpp      crtinit.c    dirent.c \
  2082. ! dup.c          exec.c        execp.c      fcntl.c    fopenp.c \
  2083. ! fork.c          fscanf.c        getcwd.c      getdtabl.c    getgroup.c \
  2084. ! gethostn.c    getpages.c    getrusag.c      heapbase.c    ident.c \
  2085. ! inistack.c    initsig.c        ioctl.c      isatty.c    kill.c \
  2086. ! killpg.c      link.c        lockf.c      main.c    mincl \
  2087. ! mkdir.c          mkfifo.c        mknod.c      nice.c    open.c \
  2088. ! osbind.cpp    pause.c        pipe.c      popen.c    putpwent.c \
  2089. ! read.c          rename.c        rmdir.c      scandir.c    scanf.c \
  2090.   select.c      setrlimi.c    sigactio.c      sigblock.c    signal.c \
  2091.   sleep.c          spawn.c        spawnve.c      spawnvp.c    sscanf.c \
  2092.   stat.c          statfs.c        symlink.c      sync.c    sysconf.c \
  2093.   tcattr.c      tcbreak.c        tcdrain.c      tcflow.c    tcflush.c \
  2094. ! tcpgrp.c      thread.c        times.c      truncate.c    ttyname.c \
  2095. ! uname.c          unlink.c        unx2dos.c      utmp.c    vfork.cpp \
  2096. ! wait.c          wait3.c        waitpid.c      write.c    wtmp.c \
  2097.   
  2098.   MINTLIB_NOCL= \
  2099.   AUTHORS          Bugs        Changelog      Copyright    Files \
  2100. --- 6,69 ----
  2101.   _mulsf3.cpp   _mulsi3.s        _negdf2.s      _negsf2.s    _normdf.cpp \
  2102.   _normsf.cpp   _truncdf.cpp  _udivmod.s      _umulsi3.s    a64l.c \
  2103.   abort.c          abs.c        access.c      alglobal.c    alloca.cpp \
  2104. ! alphasor.c    atof.c        atoi.c      atol.c    bblink.c \
  2105. ! bcmp.c          bcopy.cpp        binmode.c      bsearch.c    buffindf.c \
  2106. ! bzero.cpp     calloc.c        chdir.c      chmod.c    chown.c \
  2107. ! ctermid.c     ctime.c        ctype.c      cuserid.c    defmode.c \
  2108. ! difftime.c    div.c        div.cpp      doprnt.c    eprintf.c \
  2109. ! errbase.h     fclose.c        fdopen.c      fflush.c    ffs.c \
  2110. ! fgetc.c          fgetpos.c        fgets.c      filbuf.c    findfile.c \
  2111. ! flonum.h      fopen.c        fopen_i.c      fprintf.c    fputc.c \
  2112. ! fputs.c          fread.c        freopen.c      frexp.cpp    frwbin.c \
  2113. ! fseek.c          fsetpos.c        ftell.c      ftw.c        fungetc.c \
  2114. ! fwrite.c      gbl-ctors.h   getbuf.c      getegid.c    getenv.c \
  2115. ! geteuid.c     getgid.c        getlogin.c      getopt.c    getpass.c \
  2116. ! getpid.c      getppid.c        getpw.c      gets.c    getuid.c \
  2117.   getw.c          gmon.c        gnulib2.c      grp.c        ic.c \
  2118. ! ig.c          il.c        ip.c      iw.c        l64a.c \
  2119. ! labs.c          ldexp.cpp        ldiv.c      lib.h        libgcc1.c \
  2120. ! libgcc2.c     linea.c        localtim.c      longlong.h    lseek.c \
  2121. ! ltoa.c          malloc.c        memccpy.c      memchr.c    memcmp.c \
  2122. ! mktemp.c      modf.cpp        nlist.c      obstack.c    perror.c \
  2123. ! pgrp.c          printf.c        psignal.c      putenv.c    puts.c \
  2124. ! qsort.c          raise.c        rand.c      random.c    realloc.c \
  2125. ! regexp.c      regsup.c        rewind.c      sbrk.c    setbuf.c \
  2126. ! setegid.c     seteuid.c        setgid.c      setjmp.cpp    setlocal.c \
  2127. ! setregid.c    setreuid.c    setuid.c      setvbuf.c    sgtty.c \
  2128. ! siglist.c     sprintf.c        stksiz.c      strcat.c    strchr.c \
  2129. ! strcmp.c      strcoll.c        strcpy.c      strcspn.c    strdup.c \
  2130. ! strerror.c    strftime.c    stricmp.c      strlen.c    strlwr.c \
  2131. ! strncat.c     strncmp.c        strncpy.c      strnicmp.c    strpbrk.c \
  2132. ! strrchr.c     strrev.c        strspn.c      strstr.c    strtok.c \
  2133. ! strtol.c      strtoul.c        strupr.c      system.c    sysvar.c \
  2134. ! textio.c      time.c        timeoday.c      tmpfile.c    tmpnam.c \
  2135. ! toxxx.c          uidgid.c        utime.c      vfprintf.c    vprintf.c \
  2136. ! wcmb.c          wcscat.c        wcscmp.c      wcscpy.c    wcslen.c \
  2137. ! wnull.c \
  2138.   
  2139.   MINTLIB= \
  2140. ! Makefile      alarm.c        atexit.c      cfgetisp.c    cfgetosp.c \
  2141. ! cfsetisp.c    cfsetosp.c    clock.c      close.c    closedir.c \
  2142. ! console.c     crt0.cpp        crtinit.c      do_lock.c    do_stat.c \
  2143. ! dup.c          dup2.c        enoent.c      execl.c    execle.c \
  2144. ! execp.c          execv.c        execve.c      fcntl.c    flock.c \
  2145. ! fopenp.c      fork.c        fscanf.c      fstat.c    getcwd.c \
  2146. ! getdtabl.c    getgroup.c    gethostn.c      getpages.c    getrusag.c \
  2147. ! getwd.c          heapbase.c    ident.c      inistack.c    initsig.c \
  2148. ! inode.c          ioctl.c        isatty.c      isctty.c    kill.c \
  2149. ! killpg.c      link.c        lockf.c      lstat.c    main.c \
  2150. ! mincl          mkdir.c        mkfifo.c      mknod.c    nice.c \
  2151. ! open.c          opendir.c        osbind.cpp      pause.c    pipe.c \
  2152. ! popen.c          putpwent.c    read.c      readdir.c    rename.c \
  2153. ! rewinddi.c    rmdir.c        scandir.c      scanf.c    seekdir.c \
  2154.   select.c      setrlimi.c    sigactio.c      sigblock.c    signal.c \
  2155.   sleep.c          spawn.c        spawnve.c      spawnvp.c    sscanf.c \
  2156.   stat.c          statfs.c        symlink.c      sync.c    sysconf.c \
  2157.   tcattr.c      tcbreak.c        tcdrain.c      tcflow.c    tcflush.c \
  2158. ! tcpgrp.c      telldir.c        thread.c      times.c    truncate.c \
  2159. ! ttyname.c     uname.c        unlink.c      unx2dos.c    utmp.c \
  2160. ! vfork.cpp     vfscanf.c        vscanf.c      wait.c    wait3.c \
  2161. ! waitpid.c     write.c        wtmp.c \
  2162.   
  2163.   MINTLIB_NOCL= \
  2164.   AUTHORS          Bugs        Changelog      Copyright    Files \
  2165. *** 43.1    1994/02/15 19:34:32
  2166. --- Makefile.adm    1994/02/28 18:54:30
  2167. ***************
  2168. *** 100,107 ****
  2169.           $(srcdir)/sozobon $(incdir) $(incdir)/sys ;\
  2170.       do \
  2171.         cd $$dir ;\
  2172. !       ci -l -f -m- -r$V.1 RCS/* ;\
  2173. !       co -f -l RCS/* ;\
  2174.       done
  2175.       echo '/*' > PatchLev.h
  2176.       echo ' *    This identifies the version of the MiNT library in this' >> PatchLev.h
  2177. --- 100,106 ----
  2178.           $(srcdir)/sozobon $(incdir) $(incdir)/sys ;\
  2179.       do \
  2180.         cd $$dir ;\
  2181. !       ci -l$V.1 -f -m- RCS/* ;\
  2182.       done
  2183.       echo '/*' > PatchLev.h
  2184.       echo ' *    This identifies the version of the MiNT library in this' >> PatchLev.h
  2185. ***************
  2186. *** 115,117 ****
  2187. --- 114,127 ----
  2188.       ci -f -l -m- Version
  2189.       ci -f -l -m- PatchLev.h
  2190.       cd $(incdir) ; ci -f -l -m- PatchLev.h
  2191. + checkrcs:
  2192. +     make -f Makefile distclean
  2193. +     for dir in $(srcdir) $(srcdir)/crlf $(srcdir)/lattice \
  2194. +         $(srcdir)/purec $(srcdir)/purec/unixname \
  2195. +         $(srcdir)/sozobon $(incdir) $(incdir)/sys ;\
  2196. +     do \
  2197. +       cd $$dir ;\
  2198. +       echo $$dir ;\
  2199. +       rcsdiff -u * ;\
  2200. +     done | less
  2201. *** 43.1    1994/02/15 19:34:32
  2202. --- PatchLev.h    1994/02/15 20:33:26
  2203. ***************
  2204. *** 3,6 ****
  2205.    *    directory.
  2206.    */
  2207.   
  2208. ! #define PatchLevel "43"
  2209. --- 3,6 ----
  2210.    *    directory.
  2211.    */
  2212.   
  2213. ! #define PatchLevel "44"
  2214. *** 43.1    1994/02/15 19:34:32
  2215. --- README    1994/02/28 18:22:48
  2216. ***************
  2217. *** 74,87 ****
  2218.   As of Patchlevel 31, the MiNT library no longer supports any version of 
  2219.   GCC before 2.0.
  2220.   
  2221. ! The MiNT library cannot be built on a TOS filesystem, due to name conflicts
  2222. ! between several modules (for example, _udivmod.o and _udivmoddi4.o).  It
  2223. ! should work on a cross-compiler or an ST with a filesystem such as minixfs.
  2224.   
  2225.   My configuration, used to build the library on an extended filename
  2226. ! V2 minixfs with gcc 2.3.1:
  2227.     /mint/bin/mfsconf F: -s n -d n -x t -l n
  2228. !   UNIXMODE=cu/rUx
  2229.   
  2230.   Special thanks go out to Jeff Weiner and the rest of the umich archive posse
  2231.   for letting me use terminator for the maintenance of the library.
  2232. --- 74,88 ----
  2233.   As of Patchlevel 31, the MiNT library no longer supports any version of 
  2234.   GCC before 2.0.
  2235.   
  2236. ! The GCC version of the MiNT library cannot be built on a TOS filesystem, due
  2237. ! to name conflicts between several modules (for example, _udivmod.o and
  2238. ! _udivmoddi4.o).  It should work on a cross-compiler or an ST with a
  2239. ! filesystem such as minixfs.
  2240.   
  2241.   My configuration, used to build the library on an extended filename
  2242. ! V2 minixfs with gcc 2.4.5:
  2243.     /mint/bin/mfsconf F: -s n -d n -x t -l n
  2244. !   UNIXMODE=bcu/rUxs
  2245.   
  2246.   Special thanks go out to Jeff Weiner and the rest of the umich archive posse
  2247.   for letting me use terminator for the maintenance of the library.
  2248. *** 43.1    1994/02/15 19:34:32
  2249. --- Version    1994/02/15 20:33:32
  2250. ***************
  2251. *** 1 ****
  2252. ! V=43
  2253. --- 1 ----
  2254. ! V=44
  2255. *** /dev/null    Mon Feb 28 07:43:04 1994
  2256. --- cfgetisp.c    Mon Feb 28 04:42:44 1994
  2257. ***************
  2258. *** 0 ****
  2259. --- 1,14 ----
  2260. + /*
  2261. + Public domain termios cfgetispeed() for the MiNT library
  2262. + 10 October 1993 entropy@terminator.rs.itd.umich.edu -- first attempt
  2263. + */
  2264. + #include <types.h>
  2265. + #include <termios.h>
  2266. + speed_t
  2267. + cfgetispeed(stp)
  2268. +   const struct termios *stp;
  2269. + {
  2270. +   return stp->_c_ispeed;
  2271. + }
  2272. *** /dev/null    Mon Feb 28 07:43:04 1994
  2273. --- cfgetosp.c    Mon Feb 28 04:45:02 1994
  2274. ***************
  2275. *** 0 ****
  2276. --- 1,15 ----
  2277. + /*
  2278. + Public domain termios cfgetospeed() for the MiNT library
  2279. + 10 October 1993 entropy@terminator.rs.itd.umich.edu -- first attempt
  2280. + */
  2281. + #include <types.h>
  2282. + #include <termios.h>
  2283. + speed_t
  2284. + cfgetospeed(stp)
  2285. +   const struct termios *stp;
  2286. + {
  2287. +   return stp->_c_ospeed;
  2288. + }
  2289. *** /dev/null    Mon Feb 28 07:43:04 1994
  2290. --- cfsetisp.c    Mon Feb 28 04:46:00 1994
  2291. ***************
  2292. *** 0 ****
  2293. --- 1,17 ----
  2294. + /*
  2295. + Public domain termios cfsetispeed() for the MiNT library
  2296. + 10 October 1993 entropy@terminator.rs.itd.umich.edu -- first attempt
  2297. + */
  2298. + #include <types.h>
  2299. + #include <termios.h>
  2300. + int
  2301. + cfsetispeed(stp, baudcode)
  2302. +   struct termios *stp;
  2303. +   speed_t baudcode;
  2304. + {
  2305. +   stp->_c_ispeed = baudcode;
  2306. +   return 0;
  2307. + }
  2308. *** /dev/null    Mon Feb 28 07:43:04 1994
  2309. --- cfsetosp.c    Mon Feb 28 04:47:34 1994
  2310. ***************
  2311. *** 0 ****
  2312. --- 1,17 ----
  2313. + /*
  2314. + Public domain termios cfsetospeed() for the MiNT library
  2315. + 10 October 1993 entropy@terminator.rs.itd.umich.edu -- first attempt
  2316. + */
  2317. + #include <types.h>
  2318. + #include <termios.h>
  2319. + int
  2320. + cfsetospeed(stp, baudcode)
  2321. +   struct termios *stp;
  2322. +   speed_t baudcode;
  2323. + {
  2324. +   stp->_c_ospeed = baudcode;
  2325. +   return 0;
  2326. + }
  2327. *** /dev/null    Mon Feb 28 07:43:04 1994
  2328. --- closedir.c    Mon Feb 28 05:00:18 1994
  2329. ***************
  2330. *** 0 ****
  2331. --- 1,35 ----
  2332. + /* closedir routine */
  2333. + /* under MiNT (v0.9 or better) these use the appropriate system calls.
  2334. +  * under TOS or older versions of MiNT, they use Fsfirst/Fsnext
  2335. +  *
  2336. +  * Written by Eric R. Smith and placed in the public domain
  2337. +  */
  2338. + #include <stdlib.h>
  2339. + #include <string.h>
  2340. + #include <types.h>
  2341. + #include <limits.h>
  2342. + #include <dirent.h>
  2343. + #include <errno.h>
  2344. + #include <osbind.h>
  2345. + #include <mintbind.h>
  2346. + #include "lib.h"
  2347. + extern int __mint;
  2348. + extern ino_t __inode;    /* in stat.c */
  2349. + int
  2350. + closedir(dirp)
  2351. +     DIR *dirp;
  2352. + {
  2353. +     int r;
  2354. +     if (__mint > 8) {
  2355. +         r = (int)Dclosedir(dirp->handle);
  2356. +     } else {
  2357. +         r = 0;
  2358. +     }
  2359. +     free(dirp);
  2360. +     return r;
  2361. + }
  2362. *** /dev/null    Mon Feb 28 07:43:04 1994
  2363. --- do_lock.c    Mon Feb 28 07:25:28 1994
  2364. ***************
  2365. *** 0 ****
  2366. --- 1,61 ----
  2367. + /*
  2368. +  * lockf(3) and flock(2) emulation for MiNT by Dave Gymer
  2369. +  * Placed in the public domain; do with me as you will!
  2370. +  */
  2371. + #include <errno.h>
  2372. + #include <fcntl.h>
  2373. + #include <unistd.h>
  2374. + #include <mintbind.h>
  2375. + #include <file.h>
  2376. + #include "lib.h"
  2377. + int
  2378. + _do_lock(fd, cmd, size, whence)
  2379. +     int fd;
  2380. +     int cmd;
  2381. +     long size;
  2382. +     int whence;
  2383. + {
  2384. +     struct flock lock;
  2385. +     int fcmd;
  2386. +     long r;
  2387. +     extern int __mint;
  2388. +     if (!__mint) {
  2389. +         errno = -EINVAL;
  2390. +         return -1;
  2391. +     }
  2392. +     lock.l_whence = whence;
  2393. +     lock.l_start = 0;
  2394. +     lock.l_len = size;
  2395. +     switch (cmd) {
  2396. +         case F_ULOCK:
  2397. +             lock.l_type = F_UNLCK;
  2398. +             fcmd = F_SETLK;
  2399. +             break;
  2400. +         case F_TEST:
  2401. +             lock.l_type = F_WRLCK;
  2402. +             fcmd = F_GETLK;
  2403. +             break;
  2404. +         case F_TLOCK:
  2405. +             lock.l_type = F_WRLCK;
  2406. +             fcmd = F_SETLK;
  2407. +             break;
  2408. +         case F_LOCK:
  2409. +             lock.l_type = F_WRLCK;
  2410. +             if (__mint < 95)
  2411. +                 fcmd = F_SETLK;
  2412. +             else
  2413. +                 fcmd = F_SETLKW;
  2414. +             break;
  2415. +         default:
  2416. +             errno = -EINVAL;
  2417. +             return -1;
  2418. +     }
  2419. +     if ((r = Fcntl(fd, &lock, fcmd)) < 0) {
  2420. +         errno = (int) -r;
  2421. +         return -1;
  2422. +     }
  2423. +     return 0;
  2424. + }
  2425. *** /dev/null    Mon Feb 28 07:43:04 1994
  2426. --- do_stat.c    Mon Feb 28 09:41:46 1994
  2427. ***************
  2428. *** 0 ****
  2429. --- 1,232 ----
  2430. + /*
  2431. +  * stat, fstat, lstat emulation for TOS
  2432. +  * written by Eric R. Smith and placed in the public domain
  2433. +  */
  2434. + #include <limits.h>
  2435. + #include <types.h>
  2436. + #include <stat.h>
  2437. + #include <ctype.h>
  2438. + #include <errno.h>
  2439. + #include <osbind.h>
  2440. + #include <mintbind.h>
  2441. + #include <string.h>
  2442. + #include <time.h>
  2443. + #include <unistd.h>
  2444. + #include <support.h>
  2445. + #include <ioctl.h>    /* for FSTAT */
  2446. + #include "lib.h"
  2447. + extern int __mint;
  2448. + extern ino_t __inode;
  2449. + /* for backwards compatibilty: if nonzero, files are checked to see if
  2450. +  * they have the TOS executable magic number in them
  2451. +  */
  2452. + int    _x_Bit_set_in_stat = 0;
  2453. + /* date for files (like root directories) that don't have one */
  2454. + #define OLDDATE _unixtime(0,0)
  2455. + /*
  2456. +  * common routine for stat() and lstat(); if "lflag" is 0, then symbolic
  2457. +  * links are automatically followed (like stat), if 1 then they are not
  2458. +  * (like lstat)
  2459. +  */
  2460. + __EXTERN int _do_stat __PROTO((const char *_path, struct stat *st, int lflag));
  2461. + int
  2462. + _do_stat(_path, st, lflag)
  2463. +     const char *_path;
  2464. +     struct stat *st;
  2465. +     int lflag;
  2466. + {
  2467. +     long    r;
  2468. +     _DTA    *olddta;
  2469. +     int    nval;
  2470. +     char    path[PATH_MAX];
  2471. +     char    *ext, drv;
  2472. +     int    fd;
  2473. +     short    magic;
  2474. +     _DTA    d;
  2475. +     int    isdot = 0;
  2476. +     if (!_path) {
  2477. +         errno = EFAULT;
  2478. +         return -1;
  2479. +     }
  2480. + /*
  2481. +  * _unx2dos returns 1 for device names (like /dev/con)
  2482. +  */
  2483. +     nval = _unx2dos(_path, path);
  2484. + /* for MiNT 0.9 and up, we use the built in stat() call */
  2485. +     if (__mint >= 9) {
  2486. +         r = Fxattr(lflag, path, st);
  2487. +         if (r) {
  2488. +             if ((r == -EPATH) && _enoent(path)) {
  2489. +                 r = -ENOENT;
  2490. +             }
  2491. +             errno = (int) -r;
  2492. +             return -1;
  2493. +         }
  2494. +         __UNIXTIME(st->st_mtime);
  2495. +         __UNIXTIME(st->st_atime);
  2496. +         __UNIXTIME(st->st_ctime);
  2497. +     /* Most versions of Unix count in 512 byte blocks */
  2498. +         st->st_blocks = (st->st_blocks * st->st_blksize) / 512;
  2499. +     /* if we hit a symbolic link, try to get its size right */
  2500. +         if (lflag && ((st->st_mode & S_IFMT) == S_IFLNK)) {
  2501. +             char buf[PATH_MAX + 1];
  2502. +             char buf1[PATH_MAX + 1];
  2503. +             r = Freadlink(PATH_MAX, buf, path);
  2504. +             if (r < 0)
  2505. +               {
  2506. +                 errno = (int) -r;
  2507. +                 return -1;
  2508. +               }
  2509. +             buf[PATH_MAX] = 0;
  2510. +             _dos2unx (buf, buf1);
  2511. +             st->st_size = strlen (buf1);
  2512. +         }
  2513. +         return 0;
  2514. +     }
  2515. + /* otherwise, check to see if we have a name like CON: or AUX: */
  2516. +     if (nval == 1) {
  2517. +         st->st_mode = S_IFCHR | 0600;
  2518. +         st->st_attr = 0;
  2519. +         st->st_ino = ++__inode;
  2520. +         st->st_rdev = 0;
  2521. +         st->st_mtime = st->st_ctime = st->st_atime = 
  2522. +             time((time_t *)0) - 2;
  2523. +         st->st_dev = 0;
  2524. +         st->st_nlink = 1;
  2525. +         st->st_uid = geteuid();
  2526. +         st->st_gid = getegid();
  2527. +         st->st_size = st->st_blocks = 0;
  2528. +         st->st_blksize = 1024;
  2529. +         return 0;
  2530. +     }
  2531. + /* A file name: check for root directory of a drive */
  2532. +     if (path[0] == '\\' && path[1] == 0) {
  2533. +         drv = Dgetdrv() + 'A';
  2534. +         goto rootdir;
  2535. +     }
  2536. +     if ( ((drv = path[0]) != 0) && path[1] == ':' &&
  2537. +          (path[2] == 0 || (path[2] == '\\' && path[3] == 0)) ) {
  2538. + rootdir:
  2539. +         st->st_mode = S_IFDIR | 0755;
  2540. +         st->st_attr = FA_DIR;
  2541. +         st->st_dev = isupper(drv) ? drv - 'A' : drv - 'a';
  2542. +         st->st_ino = 2;
  2543. +         st->st_mtime = st->st_ctime = st->st_atime = OLDDATE;
  2544. +         goto fill_dir;
  2545. +     }
  2546. + /* forbid wildcards in path names */
  2547. +     if (index(path, '*') || index(path, '?')) {
  2548. +         errno = ENOENT;
  2549. +         return -1;
  2550. +     }
  2551. + /* OK, here we're going to have to do an Fsfirst to get the date */
  2552. + /* NOTE: Fsfirst(".",-1) or Fsfirst("..",-1) both fail under TOS,
  2553. +  * so we kludge around this by using the fact that Fsfirst(".\*.*"
  2554. +  * or "..\*.*" will return the correct file first (except, of course,
  2555. +  * in root directories :-( ).
  2556. +  * NOTE2: Some versions of TOS don't like Fsfirst("RCS\\", -1) either,
  2557. +  * so we do the same thing if the path ends in '\\'.
  2558. +  */
  2559. + /* find the end of the string */
  2560. +     for (ext = path; ext[0] && ext[1]; ext++) ;
  2561. + /* add appropriate kludge if necessary */
  2562. +     if (*ext == '.' && (ext == path || ext[-1] == '\\' || ext[-1] == '.')) {
  2563. +         isdot = 1;
  2564. +         strcat(path, "\\*.*");
  2565. +     } else if (*ext == '\\') {
  2566. +         isdot = 1;
  2567. +         strcat(path, "*.*");
  2568. +     }
  2569. +     olddta = Fgetdta();
  2570. +     Fsetdta(&d);
  2571. +     r = Fsfirst(path, 0xff);
  2572. +     Fsetdta(olddta);
  2573. +     if (r < 0) {
  2574. +         if (isdot && r == -ENOENT) goto rootdir;
  2575. +         errno = (int) -r;
  2576. +         return -1;
  2577. +     }    
  2578. +     if (isdot && ((d.dta_name[0] != '.') || (d.dta_name[1]))) {
  2579. +         goto rootdir;
  2580. +     }
  2581. +     st->st_mtime = st->st_ctime = st->st_atime =
  2582. +         _unixtime(d.dta_time, d.dta_date);
  2583. +     if (((drv = *path) != 0) && path[1] == ':')
  2584. +         st->st_dev = toupper(drv) - 'A';
  2585. +     else
  2586. +         st->st_dev = Dgetdrv();
  2587. +     st->st_ino = __inode++;
  2588. +     st->st_attr = d.dta_attribute;
  2589. +     if (__mint && st->st_dev == ('Q' - 'A'))
  2590. +             st->st_mode = 0644 | S_IFIFO;
  2591. +     else {
  2592. +         st->st_mode = 0644 | (st->st_attr & FA_DIR ?
  2593. +                   S_IFDIR | 0111 : S_IFREG);
  2594. +     }
  2595. +     if (st->st_attr & FA_RDONLY)
  2596. +         st->st_mode &= ~0222;    /* no write permission */
  2597. +     if (st->st_attr & FA_HIDDEN)
  2598. +         st->st_mode &= ~0444;    /* no read permission */
  2599. + /* check for a file with an executable extension */
  2600. +     ext = strrchr(_path, '.');
  2601. +     if (ext) {
  2602. +         if (!strcmp(ext, ".ttp") || !strcmp(ext, ".prg") ||
  2603. +             !strcmp(ext, ".tos") || !strcmp(ext, ".g") ||
  2604. +             !strcmp(ext, ".sh")     || !strcmp(ext, ".bat")) {
  2605. +             st->st_mode |= 0111;
  2606. +         }
  2607. +     }
  2608. +     if ( (st->st_mode & S_IFMT) == S_IFREG) {
  2609. +         if (_x_Bit_set_in_stat) {
  2610. +             if ((fd = (int) Fopen(path,0)) < 0) {
  2611. +                 errno = -fd;
  2612. +                 return -1;
  2613. +             }
  2614. +             magic = 0;
  2615. +             (void)Fread(fd,2,(char *)&magic);
  2616. +             (void)Fclose(fd);
  2617. +             if (magic == 0x601A    /* TOS executable */
  2618. +                 || magic == 0x2321) /* "#!" shell file */
  2619. +                 st->st_mode |= 0111;
  2620. +         }
  2621. +         st->st_size = d.dta_size;
  2622. +     /* in Unix, blocks are measured in 512 bytes */
  2623. +         st->st_blocks = (st->st_size + 511) / 512;
  2624. +         st->st_nlink = 1; /* we dont have hard links */
  2625. +     } else {
  2626. + fill_dir:
  2627. +         st->st_size = 1024;
  2628. +         st->st_blocks = 2;
  2629. +         st->st_nlink = 2;    /* "foo" && "foo/.." */
  2630. +     }
  2631. +     st->st_rdev = 0;
  2632. +     st->st_uid = geteuid();    /* the current user owns every file */
  2633. +     st->st_gid = getegid();
  2634. +     st->st_blksize = 1024;
  2635. +     return 0;
  2636. + }
  2637. *** 43.1    1994/02/15 19:34:32
  2638. --- dup.c    1994/02/28 10:16:02
  2639. ***************
  2640. *** 1,11 ****
  2641.   /* from Dale Schumacher's dLibs library */
  2642.   
  2643. ! /* these will have to be adjusted at some time ++jrb */
  2644. ! /* use these with caution, TOS 1.4 still has double re-direction bug! */
  2645.   
  2646.   #include <stddef.h>
  2647.   #include <fcntl.h>
  2648. - #include <osbind.h>
  2649.   #include <errno.h>
  2650.   #include <mintbind.h>
  2651.   #include <unistd.h>
  2652. --- 1,10 ----
  2653.   /* from Dale Schumacher's dLibs library */
  2654.   
  2655. ! /* will have to be adjusted at some time ++jrb */
  2656. ! /* use with caution, TOS 1.4 still has double re-direction bug! */
  2657.   
  2658.   #include <stddef.h>
  2659.   #include <fcntl.h>
  2660.   #include <errno.h>
  2661.   #include <mintbind.h>
  2662.   #include <unistd.h>
  2663. ***************
  2664. *** 43,68 ****
  2665.       return(rv);
  2666.   }
  2667.   
  2668. - int
  2669. - dup2(handle1, handle2)
  2670. -     int handle1, handle2;
  2671. - {
  2672. -     int rv;
  2673. -     long flags;
  2674. -     if (handle1 == handle2)
  2675. -         return (handle2);
  2676. -     if ((rv = (int)Fforce(handle2, handle1)) < 0)
  2677. -         errno = -rv;
  2678. -     else {
  2679. -         if (__OPEN_INDEX(handle2) < __NHANDLES)
  2680. -             __open_stat[__OPEN_INDEX(handle2)] =
  2681. -                 __open_stat[__OPEN_INDEX(handle1)];
  2682. -         if (__mint) {
  2683. -             flags = (long)Fcntl(handle2, (long)0, F_GETFD);
  2684. -             (void)Fcntl(handle2, flags & ~FD_CLOEXEC, F_SETFD);
  2685. -         }
  2686. -     }
  2687. -     return (rv < 0) ? -1 : handle2;
  2688. - }
  2689. --- 42,44 ----
  2690. *** /dev/null    Mon Feb 28 07:43:04 1994
  2691. --- dup2.c    Mon Feb 28 05:15:16 1994
  2692. ***************
  2693. *** 0 ****
  2694. --- 1,37 ----
  2695. + /* from Dale Schumacher's dLibs library */
  2696. + /* will have to be adjusted at some time ++jrb */
  2697. + /* use with caution, TOS 1.4 still has double re-direction bug! */
  2698. + #include <stddef.h>
  2699. + #include <fcntl.h>
  2700. + #include <errno.h>
  2701. + #include <mintbind.h>
  2702. + #include <unistd.h>
  2703. + #include "lib.h"
  2704. + extern int __mint;
  2705. + int
  2706. + dup2(handle1, handle2)
  2707. +     int handle1, handle2;
  2708. + {
  2709. +     int rv;
  2710. +     long flags;
  2711. +     if (handle1 == handle2)
  2712. +         return (handle2);
  2713. +     if ((rv = (int)Fforce(handle2, handle1)) < 0)
  2714. +         errno = -rv;
  2715. +     else {
  2716. +         if (__OPEN_INDEX(handle2) < __NHANDLES)
  2717. +             __open_stat[__OPEN_INDEX(handle2)] =
  2718. +                 __open_stat[__OPEN_INDEX(handle1)];
  2719. +         if (__mint) {
  2720. +             flags = (long)Fcntl(handle2, (long)0, F_GETFD);
  2721. +             (void)Fcntl(handle2, flags & ~FD_CLOEXEC, F_SETFD);
  2722. +         }
  2723. +     }
  2724. +     return (rv < 0) ? -1 : handle2;
  2725. + }
  2726. *** /dev/null    Mon Feb 28 07:43:04 1994
  2727. --- enoent.c    Mon Feb 28 03:39:32 1994
  2728. ***************
  2729. *** 0 ****
  2730. --- 1,46 ----
  2731. + #include <errno.h>
  2732. + #include <string.h>
  2733. + #include <stat.h>
  2734. + #include <mintbind.h>
  2735. + #include "lib.h"
  2736. + extern int __mint;
  2737. + /*
  2738. + Given a pathname for which some system call returned EPATH, this function
  2739. + decides if UNIX would have returned ENOENT instead.
  2740. + Warning: path must be in dos format.
  2741. + */
  2742. + int
  2743. + _enoent(path)
  2744. +   char *path;
  2745. + {
  2746. +   register char *s;
  2747. +   struct stat st;
  2748. +   long oldmask;
  2749. +   if (__mint < 9)
  2750. +   {
  2751. +     return 0; /* don't bother... */
  2752. +   }
  2753. +   for (s = path; *s; s++)
  2754. +     /* nop */;
  2755. +   oldmask = Psigblock(~0L);
  2756. +   for ( ; s != path; s--)
  2757. +   {
  2758. +     if (*s == '\\')
  2759. +     {
  2760. +       *s = '\0';
  2761. +       if ((Fxattr(0, path, &st) == 0) && ((st.st_mode & S_IFMT) != S_IFDIR))
  2762. +       {
  2763. +         *s = '\\';
  2764. +         (void) Psigsetmask(oldmask);
  2765. +         return 0; /* existing non-directory file in path, ENOTDIR ok */
  2766. +       }
  2767. +       *s = '\\';
  2768. +     }
  2769. +   }
  2770. +   (void) Psigsetmask(oldmask);
  2771. +   return 1; /* should have been ENOENT */
  2772. + }
  2773. *** /dev/null    Mon Feb 28 07:43:04 1994
  2774. --- execl.c    Mon Feb 28 05:26:44 1994
  2775. ***************
  2776. *** 0 ****
  2777. --- 1,21 ----
  2778. + /*
  2779. +     execl for MiNT/TOS; written by Eric R. Smith, and
  2780. +     placed in the public domain
  2781. + */
  2782. + #include <stdarg.h>
  2783. + #include <process.h>
  2784. + #include <unistd.h>
  2785. + #ifdef __STDC__
  2786. + int execl(const char *path, ...)
  2787. + #else
  2788. + int execl(path)
  2789. +     char    *path;
  2790. + #endif
  2791. + {
  2792. +     va_list args;
  2793. +     va_start(args, path);
  2794. +     return _spawnve(P_OVERLAY, path, (char **)args, NULL);
  2795. + }
  2796. *** /dev/null    Mon Feb 28 07:43:04 1994
  2797. --- execle.c    Mon Feb 28 05:26:36 1994
  2798. ***************
  2799. *** 0 ****
  2800. --- 1,25 ----
  2801. + /*
  2802. +     execle for MiNT/TOS; written by Eric R. Smith, and
  2803. +     placed in the public domain
  2804. + */
  2805. + #include <stdarg.h>
  2806. + #include <process.h>
  2807. + #include <unistd.h>
  2808. + #ifdef __STDC__
  2809. + int execle(const char *path, ...)
  2810. + #else
  2811. + int execle(path)
  2812. +     char    *path;
  2813. + #endif
  2814. + {
  2815. +     va_list args;
  2816. +     char    ***envp;
  2817. +     va_start(args, path);
  2818. +     for (envp = (char ***) args ; *envp ; envp++)
  2819. +         ;
  2820. +     return _spawnve(P_OVERLAY, path, (char **)args, *(envp+1));
  2821. + }
  2822. *** /dev/null    Mon Feb 28 07:43:04 1994
  2823. --- execv.c    Mon Feb 28 05:21:58 1994
  2824. ***************
  2825. *** 0 ****
  2826. --- 1,16 ----
  2827. + /*
  2828. +     execv for MiNT/TOS; written by Eric R. Smith, and
  2829. +     placed in the public domain
  2830. + */
  2831. + #include <process.h>
  2832. + #include <unistd.h>
  2833. + int
  2834. + execv(path, argv)
  2835. +     const char *path;
  2836. +     char *const *argv;
  2837. + {
  2838. +     return _spawnve(P_OVERLAY, path, argv, NULL);
  2839. + }
  2840. *** /dev/null    Mon Feb 28 07:43:04 1994
  2841. --- execve.c    Mon Feb 28 05:20:04 1994
  2842. ***************
  2843. *** 0 ****
  2844. --- 1,17 ----
  2845. + /*
  2846. +     execve for MiNT/TOS; written by Eric R. Smith, and
  2847. +     placed in the public domain
  2848. + */
  2849. + #include <process.h>
  2850. + #include <unistd.h>
  2851. + int
  2852. + execve(path, argv, envp)
  2853. +     const char *path;
  2854. +     char *const *argv;
  2855. +     char *const *envp;
  2856. + {
  2857. +     return _spawnve(P_OVERLAY, path, argv, envp);
  2858. + }
  2859. *** /dev/null    Mon Feb 28 07:43:04 1994
  2860. --- flock.c    Mon Feb 28 07:31:06 1994
  2861. ***************
  2862. *** 0 ****
  2863. --- 1,27 ----
  2864. + /*
  2865. +  * lockf(3) and flock(2) emulation for MiNT by Dave Gymer
  2866. +  * Placed in the public domain; do with me as you will!
  2867. +  */
  2868. + #include <errno.h>
  2869. + #include <fcntl.h>
  2870. + #include <unistd.h>
  2871. + #include <file.h>
  2872. + #include "lib.h"
  2873. + int
  2874. + flock(fd, op)
  2875. +     int fd, op;
  2876. + {
  2877. +     int cmd;
  2878. +     if (op & (LOCK_SH | LOCK_EX))
  2879. +         cmd = (op & LOCK_NB) ? F_TLOCK : F_LOCK;
  2880. +     else if (op & LOCK_UN)
  2881. +         cmd = F_ULOCK;
  2882. +     else {
  2883. +         errno = -EINVAL;
  2884. +         return -1;
  2885. +     }
  2886. +     return _do_lock(fd, cmd, 0L, 0);
  2887. + }
  2888. *** 43.1    1994/02/15 19:34:32
  2889. --- fscanf.c    1994/02/28 11:20:14
  2890. ***************
  2891. *** 46,65 ****
  2892.       return(_scanf(stdin, fgetc, fungetc, fmt, &arg));
  2893.       }
  2894.   #endif /* __STDC__ */
  2895. - int
  2896. - vscanf(fmt, arg)
  2897. -     const char *fmt;
  2898. -     va_list arg;
  2899. -     {
  2900. -     return(_scanf(stdin, fgetc, fungetc, fmt, arg));
  2901. -     }
  2902. - int
  2903. - vfscanf(fp, fmt, arg)
  2904. -     FILE *fp;
  2905. -     const char *fmt;
  2906. -     va_list arg;
  2907. -     {
  2908. -     return(_scanf(fp, fgetc, fungetc, fmt, arg));
  2909. -     }
  2910. --- 46,48 ----
  2911. *** /dev/null    Mon Feb 28 07:43:04 1994
  2912. --- fstat.c    Mon Feb 28 09:01:58 1994
  2913. ***************
  2914. *** 0 ****
  2915. --- 1,96 ----
  2916. + #include <limits.h>
  2917. + #include <types.h>
  2918. + #include <stat.h>
  2919. + #include <ctype.h>
  2920. + #include <errno.h>
  2921. + #include <osbind.h>
  2922. + #include <mintbind.h>
  2923. + #include <string.h>
  2924. + #include <time.h>
  2925. + #include <unistd.h>
  2926. + #include <support.h>
  2927. + #include <ioctl.h>    /* for FSTAT */
  2928. + #include "lib.h"
  2929. + extern int __mint;
  2930. + extern ino_t __inode;
  2931. + __EXTERN int _do_stat __PROTO((const char *_path, struct stat *st, int lflag));
  2932. + /* 
  2933. +  * fstat: if we're not running under MiNT, this is pretty bogus.
  2934. +  * what we can really find is:
  2935. +  * modification time: via Fdatime()
  2936. +  * file size: via Fseek()
  2937. +  * fortunately, these are the things most programs are interested in.
  2938. +  * BUG: passing an invalid file descriptor gets back a stat structure for
  2939. +  * a tty.
  2940. +  */
  2941. + int
  2942. + fstat(fd, st)
  2943. + int fd;
  2944. + struct stat *st;
  2945. + {
  2946. +     long oldplace, r;
  2947. +     _DOSTIME timeptr;
  2948. +     short magic;
  2949. +     if (__mint >= 9) {        /* use FSTAT Fcntl */
  2950. +         r = Fcntl(fd, (long)st, FSTAT);
  2951. +         if (r) {
  2952. +             errno = (int) -r;
  2953. +             return -1;
  2954. +         }
  2955. +         __UNIXTIME(st->st_mtime);
  2956. +         __UNIXTIME(st->st_atime);
  2957. +         __UNIXTIME(st->st_ctime);
  2958. +         st->st_blocks = (st->st_blocks * st->st_blksize) / 512;
  2959. +         return 0;
  2960. +     }
  2961. +     r = Fdatime(&timeptr, fd, 0);
  2962. +     if (r < 0) {            /* assume TTY */
  2963. +         st->st_mode = S_IFCHR | 0600;
  2964. +         st->st_attr = 0;
  2965. +         st->st_mtime = st->st_ctime = st->st_atime =
  2966. +             time((time_t *)0) - 2;
  2967. +         st->st_size = 0;
  2968. +     } else {
  2969. +         st->st_mtime = st->st_atime = st->st_ctime =
  2970. +             _unixtime(timeptr.time, timeptr.date);
  2971. +         st->st_mode = S_IFREG | 0644;        /* this may be false */
  2972. +         st->st_attr = 0;            /* because this is */
  2973. +     /* get current file location */
  2974. +         oldplace = Fseek(0L, fd, SEEK_CUR);
  2975. +         if (oldplace < 0) {        /* can't seek -- must be pipe */
  2976. +             st->st_mode = S_IFIFO | 0644;
  2977. +             st->st_size = 1024;
  2978. +         } else {
  2979. +             r = Fseek(0L, fd, SEEK_END);    /* go to end of file */
  2980. +             st->st_size = r;
  2981. +             (void)Fseek(0L, fd, SEEK_SET);    /* go to start of file */
  2982. +             /* check for executable file */
  2983. +             if (Fread(fd, 2, (char *)&magic) == 2) {
  2984. +                 if (magic == 0x601a || magic == 0x2321)
  2985. +                     st->st_mode |= 0111;
  2986. +             }
  2987. +             (void)Fseek(oldplace, fd, SEEK_SET);
  2988. +         }
  2989. +     }
  2990. + /* all this stuff is likely bogus as well. sigh. */
  2991. +     st->st_dev = Dgetdrv();
  2992. +     st->st_rdev = 0;
  2993. +     st->st_uid = getuid();
  2994. +     st->st_gid = getgid();
  2995. +     st->st_blksize = 1024;
  2996. + /* note: most Unixes measure st_blocks in 512 byte units */
  2997. +     st->st_blocks = (st->st_size + 511) / 512;
  2998. +     st->st_ino = ++__inode;
  2999. +     st->st_nlink = 1;
  3000. +     return 0;
  3001. + }
  3002. *** 43.1    1994/02/15 19:34:32
  3003. --- getcwd.c    1994/02/28 11:36:12
  3004. ***************
  3005. *** 60,75 ****
  3006.       return buf;
  3007.   }
  3008.   
  3009. - /*
  3010. -  * char *getwd(char *buf)
  3011. -  *    return cwd in buf
  3012. -  */
  3013. - char *getwd(buf)
  3014. - char *buf;
  3015. - {
  3016. -   char *ret = getcwd(buf, PATH_MAX);
  3017. -   if (ret)
  3018. -     return ret;
  3019. -   strcpy (buf, strerror (errno));
  3020. -   return NULL;
  3021. - }
  3022. --- 60,62 ----
  3023. *** /dev/null    Mon Feb 28 07:43:04 1994
  3024. --- getwd.c    Mon Feb 28 09:54:48 1994
  3025. ***************
  3026. *** 0 ****
  3027. --- 1,20 ----
  3028. + #include <limits.h>
  3029. + #include <string.h>
  3030. + #include <unistd.h>
  3031. + #include <errno.h>
  3032. + #include "lib.h"
  3033. + /*
  3034. +  * char *getwd(char *buf)
  3035. +  *    return cwd in buf
  3036. +  */
  3037. + char *
  3038. + getwd(buf)
  3039. +   char *buf;
  3040. + {
  3041. +   char *ret = getcwd(buf, PATH_MAX);
  3042. +   if (ret)
  3043. +     return ret;
  3044. +   strcpy(buf, strerror(errno));
  3045. +   return NULL;
  3046. + }
  3047. *** /dev/null    Mon Feb 28 07:43:04 1994
  3048. --- inode.c    Mon Feb 28 04:22:50 1994
  3049. ***************
  3050. *** 0 ****
  3051. --- 1,4 ----
  3052. + #include <types.h>
  3053. + ino_t __inode = 32; /* used in readdir, _do_stat, fstat */
  3054. *** 43.1    1994/02/15 19:34:32
  3055. --- ioctl.c    1994/02/21 19:16:42
  3056. ***************
  3057. *** 10,15 ****
  3058. --- 10,16 ----
  3059.   #include <unistd.h>
  3060.   #include <linea.h>    /* for TIOCGWINSZ under TOS */
  3061.   #include <support.h>
  3062. + #include <stat.h>
  3063.   #include "lib.h"    /* for __open_stat */
  3064.   
  3065.   extern int __mint;    /* MiNT version */
  3066. ***************
  3067. *** 28,86 ****
  3068.       int istty = isatty(fd);
  3069.       struct sgttyb *sg = (struct sgttyb *) arg;
  3070.       int null_fd;
  3071.   
  3072.       if (istty) {
  3073. !         if (cmd == TIOCGETD) {
  3074.               *((int *)arg) = _ttydisc;
  3075.               return 0;
  3076. !         } else if (cmd == TIOCSETD) {
  3077.               _ttydisc = *((int *)arg);
  3078.               return 0;
  3079. !         } else if (cmd == TIOCLGET) {
  3080.               *((int *)arg) = _ldisc;
  3081.               return 0;
  3082. !         } else if (cmd == TIOCLSET) {
  3083.               _ldisc = *((int *)arg);
  3084.               return 0;
  3085. !         } else if (cmd == TIOCSWINSZ && __mint < 9) {
  3086. !             return 0;
  3087. !         } else if (cmd == TIOCGWINSZ && __mint < 9) {
  3088. !             struct winsize *win = (struct winsize *)arg;
  3089.   #ifndef __SOZOBON__
  3090. !             (void)linea0();
  3091.   #else /* __SOZOBON__ */
  3092. !             linea0();
  3093.   #endif /* __SOZOBON__ */
  3094. !             win->ws_row = V_CEL_MY + 1;
  3095. !             win->ws_col = V_CEL_MX + 1;
  3096. !             win->ws_xpixel = V_X_MAX;
  3097. !             win->ws_ypixel = V_Y_MAX;
  3098. !             return 0;
  3099. !         }
  3100. ! #ifdef __MINT__
  3101. !         else if (cmd == TIOCNOTTY && __mint) {
  3102. !             if ((fd < 0) || !(_isctty(fd))) {
  3103. !                 errno = EBADF;
  3104. !                 return -1;
  3105.               }
  3106. !             (void) Fclose(fd);
  3107. !             null_fd = (int) Fopen(__mint < 9 ? "V:\\null"
  3108. !                     : "U:\\dev\\null", O_RDWR);
  3109. !             (void) Fforce(-1, null_fd);
  3110. !             __open_stat[__OPEN_INDEX(-1)].status = FH_UNKNOWN;
  3111. !             __open_stat[__OPEN_INDEX(fd)].status = FH_UNKNOWN;
  3112. !             if (null_fd != fd) {
  3113. !                 (void) Fforce(fd, null_fd);
  3114. !                 (void) Fclose(null_fd);
  3115.               }
  3116. !             return 0;
  3117. !         }
  3118.   #endif /* __MINT__ */
  3119.       }
  3120.   
  3121.       if (__mint) {
  3122. !         r = Fcntl(fd, arg, cmd);
  3123.       }
  3124.       else if (istty) {
  3125.           r = 0;
  3126. --- 29,164 ----
  3127.       int istty = isatty(fd);
  3128.       struct sgttyb *sg = (struct sgttyb *) arg;
  3129.       int null_fd;
  3130. +     long baud;
  3131.   
  3132.       if (istty) {
  3133. !         switch (cmd) {
  3134. !         case TIOCGETD:
  3135.               *((int *)arg) = _ttydisc;
  3136.               return 0;
  3137. !             break;
  3138. !         case TIOCSETD:
  3139.               _ttydisc = *((int *)arg);
  3140.               return 0;
  3141. !             break;
  3142. !         case TIOCLGET:
  3143.               *((int *)arg) = _ldisc;
  3144.               return 0;
  3145. !             break;
  3146. !         case TIOCLSET:
  3147.               _ldisc = *((int *)arg);
  3148.               return 0;
  3149. !             break;
  3150. !         case TIOCSWINSZ:
  3151. !             if (__mint < 9)
  3152. !                 return 0;
  3153. !             break;
  3154. !         case TIOCGWINSZ:
  3155. !             if (__mint < 9) {
  3156. !                 struct winsize *win = (struct winsize *)arg;
  3157.   #ifndef __SOZOBON__
  3158. !                 (void)linea0();
  3159.   #else /* __SOZOBON__ */
  3160. !                 linea0();
  3161.   #endif /* __SOZOBON__ */
  3162. !                 win->ws_row = V_CEL_MY + 1;
  3163. !                 win->ws_col = V_CEL_MX + 1;
  3164. !                 win->ws_xpixel = V_X_MAX;
  3165. !                 win->ws_ypixel = V_Y_MAX;
  3166. !                 return 0;
  3167.               }
  3168. !             break;
  3169. ! #ifdef __MINT__
  3170. !         case TIOCNOTTY:
  3171. !             if (__mint) {
  3172. !                 if ((fd < 0) || !(_isctty(fd))) {
  3173. !                     errno = EBADF;
  3174. !                     return -1;
  3175. !                 }
  3176. !                 (void) Fclose(fd);
  3177. !                 null_fd = (int) Fopen(__mint < 9 ? "V:\\null"
  3178. !                         : "U:\\dev\\null", O_RDWR);
  3179. !                 (void) Fforce(-1, null_fd);
  3180. !                 __open_stat[__OPEN_INDEX(-1)].status =
  3181. !                     FH_UNKNOWN;
  3182. !                 __open_stat[__OPEN_INDEX(fd)].status =
  3183. !                     FH_UNKNOWN;
  3184. !                 if (null_fd != fd) {
  3185. !                     (void) Fforce(fd, null_fd);
  3186. !                     (void) Fclose(null_fd);
  3187. !                 }
  3188. !                 return 0;
  3189.               }
  3190. !             break;
  3191.   #endif /* __MINT__ */
  3192. +         default:
  3193. +             break;
  3194. +         }
  3195.       }
  3196.   
  3197.       if (__mint) {
  3198. !       switch (cmd) {
  3199. !         case TIOCCDTR:
  3200. !           baud = 0;
  3201. !           r = Fcntl(fd, &baud, TIOCOBAUD);
  3202. !           if (r < 0) {
  3203. !             errno = (int) -r;
  3204. !         return -1;
  3205. !           }
  3206. !           return 0;
  3207. !           break;
  3208. !         case TIOCSDTR:
  3209. !           baud = -1;
  3210. !           r = Fcntl(fd, &baud, TIOCOBAUD);
  3211. !           if (r < 0) {
  3212. !             errno = (int) -r;
  3213. !         return -1;
  3214. !           }
  3215. !           r = Fcntl(fd, &baud, TIOCOBAUD);
  3216. !           if (r < 0) {
  3217. !             errno = (int) -r;
  3218. !         return -1;
  3219. !           }
  3220. !           return 0;
  3221. !           break;
  3222. !         case TIOCMGET:
  3223. !           if (__mint >= 0x10a) {
  3224. !                 char g;
  3225. !                 long ssp;
  3226. !                 short *mfp;
  3227. !                 short m;
  3228. !                 struct stat sb;
  3229. !                 long *msig;
  3230. !                 msig = (long *) arg;
  3231. !                 r = Fcntl(fd, (long)&sb, FSTAT);
  3232. !                 if (r < 0) {
  3233. !           errno = -r;
  3234. !                   return -1;
  3235. !         }
  3236. !                 if (((sb.st_mode & S_IFMT) == S_IFCHR) && (sb.st_rdev == 257))
  3237. !                 {
  3238. !                   *msig = TIOCM_DSR;
  3239. !                   g = Giaccess(0, 14);
  3240. !                   *msig |= ((g & (1 << 3)) ? 0 : TIOCM_RTS);
  3241. !                   *msig |= ((g & (1 << 4)) ? 0 : TIOCM_DTR);
  3242. !                   mfp = ((short *) 0xfffffa00L);
  3243. !                   ssp = Super(0L);
  3244. !                   m = *mfp & 0xff;
  3245. !                   Super(ssp);
  3246. !                   *msig |= ((m & (1 << 1)) ? 0 : TIOCM_CAR);
  3247. !                   *msig |= ((m & (1 << 2)) ? 0 : TIOCM_CTS);
  3248. !                   *msig |= ((m & (1 << 6)) ? 0 : TIOCM_RNG);
  3249. !                   return 0;
  3250. !                 }
  3251. !                 errno = EINVAL;
  3252. !                 return -1;
  3253. !                 break;
  3254. !           }
  3255. !         default:
  3256. !           r = Fcntl(fd, arg, cmd);
  3257. !           break;
  3258. !         }
  3259.       }
  3260.       else if (istty) {
  3261.           r = 0;
  3262. *** 43.1    1994/02/15 19:34:32
  3263. --- isatty.c    1994/02/28 15:00:36
  3264. ***************
  3265. *** 1,22 ****
  3266.   /* from the original GCC TOS library by jrd */
  3267.   /* this algorithm is due to Allan Pratt @ Atari.  Thanks Allan! */
  3268.   
  3269. - #include <errno.h>
  3270. - #include <osbind.h>
  3271.   #include <fcntl.h>
  3272. - #include <stdio.h>
  3273.   #include <ioctl.h>
  3274.   #include <unistd.h>
  3275. - #include <string.h>
  3276. - #include <support.h>
  3277. - #include <stat.h>
  3278.   #include <mintbind.h>
  3279.   #include "lib.h"
  3280.   
  3281.   struct __open_file __open_stat[__NHANDLES];
  3282.   
  3283. ! int isatty(fd)
  3284. ! int fd;
  3285.   {
  3286.     int rc;
  3287.     long oldloc;
  3288. --- 1,18 ----
  3289.   /* from the original GCC TOS library by jrd */
  3290.   /* this algorithm is due to Allan Pratt @ Atari.  Thanks Allan! */
  3291.   
  3292.   #include <fcntl.h>
  3293.   #include <ioctl.h>
  3294. + #include <stdio.h>
  3295.   #include <unistd.h>
  3296.   #include <mintbind.h>
  3297.   #include "lib.h"
  3298.   
  3299.   struct __open_file __open_stat[__NHANDLES];
  3300.   
  3301. ! int
  3302. ! isatty(fd)
  3303. !   int fd;
  3304.   {
  3305.     int rc;
  3306.     long oldloc;
  3307. ***************
  3308. *** 42,81 ****
  3309.       else
  3310.           __open_stat[handle].status = FH_ISAFILE;
  3311.     return (rc);            /* return true, false, or error */
  3312. - }
  3313. - /* _isctty():  determine if a file descriptor refers to this process's
  3314. -    controlling tty.
  3315. - */
  3316. - int
  3317. - _isctty(fd)
  3318. -   int fd;
  3319. - {
  3320. - #if 0
  3321. -   char ctty_name[L_ctermid];
  3322. -   char ftty_name[L_ctermid];
  3323. - #endif
  3324. -   struct stat st, tt;
  3325. -   extern int __mint;
  3326. -   if (!(isatty(fd)) || !(isatty(-1)))
  3327. -     return 0;
  3328. -   if (fd == -1)
  3329. -     return 1;
  3330. - #if 1
  3331. -   if (__mint >= 9 && !Fcntl (fd, &st, FSTAT) && !Fcntl (-1, &tt, FSTAT)) {
  3332. -     /* shouldn't this be as good?  the stuff below takes ages...
  3333. -        (still loses on /dev/aux etc but ttyname can't be much better)
  3334. -     */
  3335. -     return (st.st_dev == tt.st_dev && st.st_ino == tt.st_ino);
  3336. -   }
  3337. -   /* We know that __mint < 9 (the Fcntl's above don't have the chance
  3338. -      to fail), use the same algorithm that ttyname() uses in this
  3339. -      case: it returns "/dev/aux" if fd == -2 */
  3340. -   return fd != -2;
  3341. - #else
  3342. -   (void) ctermid(ctty_name);
  3343. -   (void) strncpy(ftty_name, ttyname(fd), L_ctermid);
  3344. -   return !(strncmp(ctty_name, ftty_name, L_ctermid));
  3345. - #endif
  3346.   }
  3347. --- 38,41 ----
  3348. *** /dev/null    Mon Feb 28 07:43:04 1994
  3349. --- isctty.c    Mon Feb 28 07:16:38 1994
  3350. ***************
  3351. *** 0 ****
  3352. --- 1,32 ----
  3353. + /* _isctty():  determine if a file descriptor refers to this process's
  3354. +    controlling tty.
  3355. + */
  3356. + #include <fcntl.h>
  3357. + #include <stdio.h>
  3358. + #include <ioctl.h>
  3359. + #include <unistd.h>
  3360. + #include <support.h>
  3361. + #include <stat.h>
  3362. + #include <mintbind.h>
  3363. + #include "lib.h"
  3364. + int
  3365. + _isctty(fd)
  3366. +   int fd;
  3367. + {
  3368. +   struct stat st, tt;
  3369. +   extern int __mint;
  3370. +   if (!(isatty(fd)) || !(isatty(-1)))
  3371. +     return 0;
  3372. +   if (fd == -1)
  3373. +     return 1;
  3374. +   if (__mint >= 9 && !Fcntl (fd, &st, FSTAT) && !Fcntl (-1, &tt, FSTAT)) {
  3375. +     return (st.st_dev == tt.st_dev && st.st_ino == tt.st_ino);
  3376. +   }
  3377. +   /* We know that __mint < 9 (the Fcntl's above don't have the chance
  3378. +      to fail), use the same algorithm that ttyname() uses in this
  3379. +      case: it returns "/dev/aux" if fd == -2 */
  3380. +   return fd != -2;
  3381. + }
  3382. *** 43.1    1994/02/15 19:34:32
  3383. --- lockf.c    1994/02/28 12:31:46
  3384. ***************
  3385. *** 3,71 ****
  3386.    * Placed in the public domain; do with me as you will!
  3387.    */
  3388.   
  3389. - #include <compiler.h>
  3390. - #include "lib.h"
  3391. - #include <errno.h>
  3392. - #include <fcntl.h>
  3393.   #include <unistd.h>
  3394. ! #include <mintbind.h>
  3395. ! #ifdef __TURBOC__
  3396. ! #include <sys\file.h>
  3397. ! #else
  3398. ! #include <sys/file.h>
  3399. ! #endif
  3400. ! static int do_lock __PROTO((int fd, int cmd, long size, int whence));
  3401. ! static int
  3402. ! do_lock(fd, cmd, size, whence)
  3403. !     int fd;
  3404. !     int cmd;
  3405. !     long size;
  3406. !     int whence;
  3407. ! {
  3408. !     struct flock lock;
  3409. !     int fcmd;
  3410. !     long r;
  3411. !     extern int __mint;
  3412. !     if (!__mint) {
  3413. !         errno = -EINVAL;
  3414. !         return -1;
  3415. !     }
  3416. !     lock.l_whence = whence;
  3417. !     lock.l_start = 0;
  3418. !     lock.l_len = size;
  3419. !     switch (cmd) {
  3420. !         case F_ULOCK:
  3421. !             lock.l_type = F_UNLCK;
  3422. !             fcmd = F_SETLK;
  3423. !             break;
  3424. !         case F_TEST:
  3425. !             lock.l_type = F_WRLCK;
  3426. !             fcmd = F_GETLK;
  3427. !             break;
  3428. !         case F_TLOCK:
  3429. !             lock.l_type = F_WRLCK;
  3430. !             fcmd = F_SETLK;
  3431. !             break;
  3432. !         case F_LOCK:
  3433. !             lock.l_type = F_WRLCK;
  3434. !             if (__mint < 95)
  3435. !                 fcmd = F_SETLK;
  3436. !             else
  3437. !                 fcmd = F_SETLKW;
  3438. !             break;
  3439. !         default:
  3440. !             errno = -EINVAL;
  3441. !             return -1;
  3442. !     }
  3443. !     if ((r = Fcntl(fd, &lock, fcmd)) < 0) {
  3444. !         errno = (int) -r;
  3445. !         return -1;
  3446. !     }
  3447. !     return 0;
  3448. ! }
  3449.   
  3450.   int
  3451.   lockf(fd, cmd, size)
  3452. --- 3,11 ----
  3453.    * Placed in the public domain; do with me as you will!
  3454.    */
  3455.   
  3456.   #include <unistd.h>
  3457. ! #include <fcntl.h>
  3458. ! #include "lib.h"
  3459.   
  3460.   int
  3461.   lockf(fd, cmd, size)
  3462. ***************
  3463. *** 73,94 ****
  3464.       int cmd;
  3465.       long size;
  3466.   {
  3467. !     return do_lock(fd, cmd, size, 1);
  3468.   }
  3469.   
  3470. - int
  3471. - flock(fd, op)
  3472. -     int fd, op;
  3473. - {
  3474. -     int cmd;
  3475. -     if (op & (LOCK_SH | LOCK_EX))
  3476. -         cmd = (op & LOCK_NB) ? F_TLOCK : F_LOCK;
  3477. -     else if (op & LOCK_UN)
  3478. -         cmd = F_ULOCK;
  3479. -     else {
  3480. -         errno = -EINVAL;
  3481. -         return -1;
  3482. -     }
  3483. -     return do_lock(fd, cmd, 0L, 0);
  3484. - }
  3485. --- 13,18 ----
  3486.       int cmd;
  3487.       long size;
  3488.   {
  3489. !     return _do_lock(fd, cmd, size, 1);
  3490.   }
  3491.   
  3492. *** /dev/null    Mon Feb 28 07:43:04 1994
  3493. --- lstat.c    Mon Feb 28 09:02:18 1994
  3494. ***************
  3495. *** 0 ****
  3496. --- 1,12 ----
  3497. + #include <stat.h>
  3498. + #include "lib.h"
  3499. + __EXTERN int _do_stat __PROTO((const char *_path, struct stat *st, int lflag));
  3500. + int
  3501. + lstat(path, st)
  3502. +     const char *path;
  3503. +     struct stat *st;
  3504. + {
  3505. +     return _do_stat(path, st, 1);
  3506. + }
  3507. *** 43.1    1994/02/15 19:34:32
  3508. --- mincl    1994/02/28 13:20:32
  3509. ***************
  3510. *** 23,51 ****
  3511.   
  3512.   #
  3513.   # ANSI stuff + support
  3514. ! ANSI =  abort.o atexit.o atof.o atol.o \
  3515.       bsearch.o \
  3516.       calloc.o clock.o ctime.o ctype.o \
  3517.       difftime.o div.o doprnt.o \
  3518.       eprintf.o \
  3519. !     fclose.o fdopen.o fflush.o fgetc.o fgets.o filbuf.o \
  3520. !     fopen.o fprintf.o fputc.o fputs.o fread.o fscanf.o fseek.o \
  3521.       fsetpos.o fungetc.o fwrite.o \
  3522.       getbuf.o getenv.o gets.o getw.o \
  3523. !     localtim.o ltoa.o main.o malloc.o \
  3524. !     printf.o qsort.o \
  3525. !     raise.o rand.o realloc.o \
  3526.       scanf.o sscanf.o setbuf.o setvbuf.o \
  3527.       setlocal.o sprintf.o strftime.o strtol.o strtoul.o system.o \
  3528.       tmpnam.o tmpfile.o toxxx.o \
  3529. !     vfprintf.o vprintf.o wcmb.o \
  3530. !     wcscat.o wcscmp.o wcscpy.o wcslen.o wnull.o
  3531.   
  3532.   #
  3533.   # other miscellaneous stuff
  3534.   PORT =  a64l.o alphasor.o abs.o buffindf.o ctermid.o cuserid.o \
  3535.       ffs.o findfile.o fopenp.o frwbin.o ftw.o \
  3536.       gethostn.o getlogin.o getopt.o getpages.o getpass.o getpw.o grp.o \
  3537.       mktemp.o nlist.o obstack.o \
  3538.       random.o regexp.o regsup.o \
  3539.       scandir.o strlwr.o strupr.o strrev.o sync.o \
  3540. --- 23,56 ----
  3541.   
  3542.   #
  3543.   # ANSI stuff + support
  3544. ! ANSI =  abort.o atexit.o atof.o atoi.o atol.o \
  3545.       bsearch.o \
  3546.       calloc.o clock.o ctime.o ctype.o \
  3547.       difftime.o div.o doprnt.o \
  3548.       eprintf.o \
  3549. !     fclose.o fdopen.o fflush.o fgetc.o fgetpos.o fgets.o filbuf.o \
  3550. !     fopen.o fopen_i.o fprintf.o fputc.o fputs.o \
  3551. !     fread.o freopen.o fscanf.o fseek.o ftell.o \
  3552.       fsetpos.o fungetc.o fwrite.o \
  3553.       getbuf.o getenv.o gets.o getw.o \
  3554. !     ldiv.o localtim.o ltoa.o \
  3555. !     main.o malloc.o \
  3556. !     printf.o puts.o \
  3557. !     qsort.o \
  3558. !     raise.o rand.o realloc.o rewind.o \
  3559.       scanf.o sscanf.o setbuf.o setvbuf.o \
  3560.       setlocal.o sprintf.o strftime.o strtol.o strtoul.o system.o \
  3561.       tmpnam.o tmpfile.o toxxx.o \
  3562. !     vfprintf.o vfscanf.o vprintf.o vscanf.o \
  3563. !     wcmb.o wcscat.o wcscmp.o wcscpy.o wcslen.o wnull.o
  3564.   
  3565.   #
  3566.   # other miscellaneous stuff
  3567.   PORT =  a64l.o alphasor.o abs.o buffindf.o ctermid.o cuserid.o \
  3568. +     enoent.o \
  3569.       ffs.o findfile.o fopenp.o frwbin.o ftw.o \
  3570.       gethostn.o getlogin.o getopt.o getpages.o getpass.o getpw.o grp.o \
  3571. +     l64a.o labs.o \
  3572.       mktemp.o nlist.o obstack.o \
  3573.       random.o regexp.o regsup.o \
  3574.       scandir.o strlwr.o strupr.o strrev.o sync.o \
  3575. ***************
  3576. *** 65,87 ****
  3577.   #
  3578.   # stuff to fake unix system calls 
  3579.   
  3580. ! UNIX=   access.o alarm.o console.o chdir.o chmod.o close.o dirent.o dup.o \
  3581. !     exec.o execp.o fcntl.o fork.o getcwd.o getpid.o getuid.o getrusag.o \
  3582. !     getdtabl.o getgroup.o ioctl.o isatty.o \
  3583. !     kill.o killpg.o link.o lockf.o lseek.o mkfifo.o mkdir.o mknod.o \
  3584. !     nice.o open.o \
  3585.       pause.o pipe.o perror.o pgrp.o popen.o psignal.o putenv.o \
  3586. !     read.o rename.o rmdir.o sbrk.o select.o sgtty.o sigactio.o \
  3587.       sigblock.o siglist.o signal.o sleep.o spawn.o spawnve.o spawnvp.o \
  3588.       setrlimi.o stat.o statfs.o symlink.o sysconf.o \
  3589. !     time.o times.o timeoday.o ttyname.o \
  3590. !     uname.o unlink.o unx2dos.o utime.o vfork.o wait.o wait3.o \
  3591. !     waitpid.o write.o
  3592.   
  3593.   #
  3594.   # termios stuff
  3595.   
  3596. ! TERMIOS=    cfspeed.o tcattr.o tcbreak.o tcdrain.o \
  3597.           tcflow.o tcflush.o tcpgrp.o
  3598.   
  3599.   #
  3600. --- 70,104 ----
  3601.   #
  3602.   # stuff to fake unix system calls 
  3603.   
  3604. ! UNIX=   access.o alarm.o \
  3605. !     console.o chdir.o chmod.o chown.o close.o closedir.o \
  3606. !     do_lock.o do_stat.o dup.o dup2.o \
  3607. !     execl.o execle.o execp.o execv.o execve.o \
  3608. !     fcntl.o flock.o fork.o fstat.o \
  3609. !     getcwd.o getdtabl.o getegid.o geteuid.o getgid.o getgroup.o \
  3610. !     getpid.o getppid.o \
  3611. !     getuid.o getrusag.o getwd.o \
  3612. !     inode.o ioctl.o isatty.o isctty.o \
  3613. !     kill.o killpg.o link.o lockf.o lseek.o lstat.o \
  3614. !     mkfifo.o mkdir.o mknod.o \
  3615. !     nice.o open.o opendir.o \
  3616.       pause.o pipe.o perror.o pgrp.o popen.o psignal.o putenv.o \
  3617. !     read.o readdir.o rewinddi.o rename.o rmdir.o \
  3618. !     sbrk.o seekdir.o select.o \
  3619. !     setegid.o seteuid.o setgid.o setregid.o setreuid.o setuid.o \
  3620. !     sgtty.o sigactio.o \
  3621.       sigblock.o siglist.o signal.o sleep.o spawn.o spawnve.o spawnvp.o \
  3622.       setrlimi.o stat.o statfs.o symlink.o sysconf.o \
  3623. !     telldir.o time.o times.o timeoday.o ttyname.o \
  3624. !     uidgid.o uname.o unlink.o unx2dos.o utime.o \
  3625. !     vfork.o \
  3626. !     wait.o wait3.o waitpid.o write.o
  3627.   
  3628.   #
  3629.   # termios stuff
  3630.   
  3631. ! TERMIOS=    cfgetisp.o cfgetosp.o cfsetisp.o cfsetosp.o \
  3632. !         tcattr.o tcbreak.o tcdrain.o \
  3633.           tcflow.o tcflush.o tcpgrp.o
  3634.   
  3635.   #
  3636. *** 43.1    1994/02/15 19:34:32
  3637. --- open.c    1994/02/27 14:07:44
  3638. ***************
  3639. *** 140,146 ****
  3640.               rv = -ENOENT;
  3641.       }
  3642.   
  3643. !     if(rv < (__SMALLEST_VALID_HANDLE)) {
  3644.           errno = -rv;
  3645.           return __SMALLEST_VALID_HANDLE - 1;
  3646.       }
  3647. --- 140,148 ----
  3648.               rv = -ENOENT;
  3649.       }
  3650.   
  3651. !     if (rv < (__SMALLEST_VALID_HANDLE)) {
  3652. !         if ((rv == -EPATH) && (_enoent(filename)))
  3653. !             rv = -ENOENT;
  3654.           errno = -rv;
  3655.           return __SMALLEST_VALID_HANDLE - 1;
  3656.       }
  3657. *** /dev/null    Mon Feb 28 07:43:04 1994
  3658. --- opendir.c    Mon Feb 28 04:56:52 1994
  3659. ***************
  3660. *** 0 ****
  3661. --- 1,98 ----
  3662. + /* opendir routine */
  3663. + /* under MiNT (v0.9 or better) these use the appropriate system calls.
  3664. +  * under TOS or older versions of MiNT, they use Fsfirst/Fsnext
  3665. +  *
  3666. +  * Written by Eric R. Smith and placed in the public domain
  3667. +  */
  3668. + #include <stdlib.h>
  3669. + #include <string.h>
  3670. + #include <types.h>
  3671. + #include <limits.h>
  3672. + #include <dirent.h>
  3673. + #include <errno.h>
  3674. + #include <osbind.h>
  3675. + #include <mintbind.h>
  3676. + #include "lib.h"
  3677. + extern int __mint;
  3678. + extern ino_t __inode;    /* in stat.c */
  3679. + DIR *
  3680. + opendir(uname)
  3681. +     const char *uname;
  3682. + {
  3683. +     DIR *d;
  3684. +     long r;
  3685. +     _DTA *olddta;
  3686. +     char name[PATH_MAX];
  3687. +     char dirpath[PATH_MAX];
  3688. +     char *p;
  3689. +     d = malloc(sizeof(DIR));
  3690. +     if (!d) {
  3691. +         errno = ENOMEM;
  3692. +         return d;
  3693. +     }
  3694. +     _unx2dos(uname, name);
  3695. +     if (__mint > 8) {
  3696. +         r = Dopendir(name, 0);
  3697. +         if ( (r & 0xff000000L) == 0xff000000L ) {
  3698. +             errno = (int) -r;
  3699. +             free(d);
  3700. +             return 0;
  3701. +         }
  3702. +         d->handle = r;
  3703. +         d->buf.d_off = 0;
  3704. +         return d;
  3705. +     }
  3706. + /* TOS emulation routines */
  3707. +     p = name;
  3708. +     if (p) {
  3709. +     /* find the end of the string */
  3710. +         for (p = name; *p; p++) ;
  3711. +     /* make sure the string ends in '\' */
  3712. +         if (*(p-1) != '\\') {
  3713. +             *p++ = '\\';
  3714. +         }
  3715. +     }
  3716. +     strcpy(p, "*.*");
  3717. +     olddta = Fgetdta();
  3718. +     Fsetdta(&(d->dta));
  3719. +     r = Fsfirst(name, 0x17);
  3720. +     Fsetdta(olddta);
  3721. +     if (r == 0) {
  3722. +         d->status = _STARTSEARCH;
  3723. +     } else if (r == -ENOENT) {
  3724. +         d->status = _NMFILE;
  3725. +     } else {
  3726. +         free(d);
  3727. +         errno = (int) -r;
  3728. +         return 0;
  3729. +     }
  3730. +     d->buf.d_off = 0;
  3731. + /* for rewinddir: if necessary, build a relative path */
  3732. +     if (name[1] == ':') {    /* absolute path, no problem */
  3733. +         dirpath[0] = 0;
  3734. +     } else {
  3735. +         dirpath[0] = Dgetdrv() + 'A';
  3736. +         dirpath[1] = ':';
  3737. +         dirpath[2] = 0;
  3738. +         if (*name != '\\')
  3739. +             (void)Dgetpath(dirpath+2, 0);
  3740. +     }
  3741. +     d->dirname = malloc(strlen(dirpath)+strlen(name)+1);
  3742. +     if (d->dirname) {
  3743. +         strcpy(d->dirname, dirpath);
  3744. +         strcat(d->dirname, name);
  3745. +     }
  3746. +     return d;
  3747. + }
  3748. *** /dev/null    Mon Feb 28 07:43:04 1994
  3749. --- readdir.c    Mon Feb 28 04:57:50 1994
  3750. ***************
  3751. *** 0 ****
  3752. --- 1,74 ----
  3753. + /* readdir routine */
  3754. + /* under MiNT (v0.9 or better) these use the appropriate system calls.
  3755. +  * under TOS or older versions of MiNT, they use Fsfirst/Fsnext
  3756. +  *
  3757. +  * Written by Eric R. Smith and placed in the public domain
  3758. +  */
  3759. + #include <stdlib.h>
  3760. + #include <string.h>
  3761. + #include <types.h>
  3762. + #include <limits.h>
  3763. + #include <dirent.h>
  3764. + #include <errno.h>
  3765. + #include <osbind.h>
  3766. + #include <mintbind.h>
  3767. + #include "lib.h"
  3768. + extern int __mint;
  3769. + extern ino_t __inode;    /* in stat.c */
  3770. + struct dirent *
  3771. + readdir(d)
  3772. +     DIR *d;
  3773. + {
  3774. +     struct dbuf {
  3775. +         long ino;
  3776. +         char name[NAME_MAX + 1];
  3777. +     } dbuf;
  3778. +     long r;
  3779. +     _DTA *olddta;
  3780. +     struct dirent *dd = &d->buf;
  3781. +     if (__mint > 8) {
  3782. +         r = (int)Dreaddir((int)(NAME_MAX+1+sizeof(long)), d->handle, (char *) &dbuf);
  3783. +         if (r == -ENMFIL)
  3784. +             return 0;
  3785. +         else if (r) {
  3786. +             errno = (int) -r;
  3787. +             return 0;
  3788. +         }
  3789. +         dd->d_ino = dbuf.ino;
  3790. +         dd->d_off++;
  3791. +         dd->d_reclen = (short)strlen(dbuf.name);
  3792. +         strcpy(dd->d_name, dbuf.name);
  3793. +         return dd;
  3794. +     }
  3795. + /* ordinary TOS search, using Fsnext. Note that the first time through,
  3796. +  * Fsfirst has already provided valid data for us; for subsequent
  3797. +  * searches, we need Fsnext.
  3798. +  */
  3799. +     if (d->status == _NMFILE)
  3800. +         return 0;
  3801. +     if (d->status == _STARTSEARCH) {
  3802. +         d->status = _INSEARCH;
  3803. +     } else {
  3804. +         olddta = Fgetdta();
  3805. +         Fsetdta(&(d->dta));
  3806. +         r = Fsnext();
  3807. +         Fsetdta(olddta);
  3808. +         if (r == -ENMFIL) {
  3809. +             d->status = _NMFILE;
  3810. +             return 0;
  3811. +         } else if (r) {
  3812. +             errno = (int)-r;
  3813. +             return 0;
  3814. +         }
  3815. +     }
  3816. +     dd->d_ino = __inode++;
  3817. +     dd->d_off++;
  3818. +     _dos2unx(d->dta.dta_name, dd->d_name);
  3819. +     dd->d_reclen = (short)strlen(dd->d_name);
  3820. +     return dd;
  3821. + }
  3822. *** /dev/null    Mon Feb 28 07:43:04 1994
  3823. --- rewinddi.c    Mon Feb 28 04:59:42 1994
  3824. ***************
  3825. *** 0 ****
  3826. --- 1,50 ----
  3827. + /* rewinddir routine */
  3828. + /* under MiNT (v0.9 or better) these use the appropriate system calls.
  3829. +  * under TOS or older versions of MiNT, they use Fsfirst/Fsnext
  3830. +  *
  3831. +  * Written by Eric R. Smith and placed in the public domain
  3832. +  */
  3833. + #include <stdlib.h>
  3834. + #include <string.h>
  3835. + #include <types.h>
  3836. + #include <limits.h>
  3837. + #include <dirent.h>
  3838. + #include <errno.h>
  3839. + #include <osbind.h>
  3840. + #include <mintbind.h>
  3841. + #include "lib.h"
  3842. + extern int __mint;
  3843. + extern ino_t __inode;    /* in stat.c */
  3844. + void
  3845. + rewinddir(dirp)
  3846. +     DIR *dirp;
  3847. + {
  3848. +     long r;
  3849. +     _DTA *olddta;
  3850. +     if (__mint >= 9) {
  3851. +         (void)Drewinddir(dirp->handle);
  3852. +         dirp->buf.d_off = 0;
  3853. +         return;
  3854. +     }
  3855. + /* I wish POSIX had allowed an error to occur here! */
  3856. +     if (!dirp->dirname) {
  3857. +         return;
  3858. +     }
  3859. +     olddta = Fgetdta();
  3860. +     Fsetdta(&(dirp->dta));
  3861. +     r = Fsfirst(dirp->dirname, 0x17);
  3862. +     Fsetdta(olddta);
  3863. +     if (r == 0) {
  3864. +         dirp->status = _STARTSEARCH;
  3865. +     } else {
  3866. +         dirp->status = _NMFILE;
  3867. +     }
  3868. +     dirp->buf.d_off = 0;
  3869. + }
  3870. *** 43.1    1994/02/15 19:34:32
  3871. --- scanf.c    1994/02/24 16:42:56
  3872. ***************
  3873. *** 259,267 ****
  3874.               charcnt++;
  3875.               c = (*get) (ip);
  3876.               if (c == EOF)
  3877. !               goto done;
  3878.               if (c == 'x' || c == 'X')
  3879.                 goto skip1;
  3880.             }
  3881.           else if (neg == -1)
  3882.             {
  3883. --- 259,272 ----
  3884.               charcnt++;
  3885.               c = (*get) (ip);
  3886.               if (c == EOF)
  3887. !               goto savnum;
  3888.               if (c == 'x' || c == 'X')
  3889.                 goto skip1;
  3890. +             /* else unget the character, it may already be a
  3891. +                        non-digit and the number would be rejected */
  3892. +             charcnt--;
  3893. +             (*unget) (c, ip);
  3894. +             c = '0';
  3895.             }
  3896.           else if (neg == -1)
  3897.             {
  3898. *** /dev/null    Mon Feb 28 07:43:04 1994
  3899. --- seekdir.c    Mon Feb 28 05:05:10 1994
  3900. ***************
  3901. *** 0 ****
  3902. --- 1,28 ----
  3903. + /* seekdir routine */
  3904. + /* under MiNT (v0.9 or better) these use the appropriate system calls.
  3905. +  * under TOS or older versions of MiNT, they use Fsfirst/Fsnext
  3906. +  *
  3907. +  * Written by Eric R. Smith and placed in the public domain
  3908. +  */
  3909. + #include <types.h>
  3910. + #include <limits.h>
  3911. + #include <dirent.h>
  3912. + #include "lib.h"
  3913. + extern int __mint;
  3914. + /* not POSIX */
  3915. + void
  3916. + seekdir(dirp, loc)
  3917. +     DIR *dirp;
  3918. +     off_t loc;
  3919. + {
  3920. +     rewinddir(dirp);
  3921. +     while (dirp->buf.d_off != loc) {
  3922. +         if (!readdir(dirp))
  3923. +             break;
  3924. +     }
  3925. + }
  3926. *** 43.1    1994/02/15 19:34:32
  3927. --- stat.c    1994/02/28 15:34:04
  3928. ***************
  3929. *** 1,332 ****
  3930. - /*
  3931. -  * stat, fstat, lstat emulation for TOS
  3932. -  * written by Eric R. Smith and placed in the public domain
  3933. -  */
  3934. - #include <limits.h>
  3935. - #include <types.h>
  3936.   #include <stat.h>
  3937. - #include <ctype.h>
  3938. - #include <errno.h>
  3939. - #include <osbind.h>
  3940. - #include <mintbind.h>
  3941. - #include <string.h>
  3942. - #include <time.h>
  3943. - #include <unistd.h>
  3944. - #include <support.h>
  3945. - #include <ioctl.h>    /* for FSTAT */
  3946.   #include "lib.h"
  3947.   
  3948. ! extern int __mint;
  3949. ! ino_t    __inode = 32;        /* used in readdir also */
  3950. ! /* for backwards compatibilty: if nonzero, files are checked to see if
  3951. !  * they have the TOS executable magic number in them
  3952. !  */
  3953. ! int    _x_Bit_set_in_stat = 0;
  3954. ! /* date for files (like root directories) that don't have one */
  3955. ! #define OLDDATE _unixtime(0,0)
  3956. ! /*
  3957. !  * macro for converting a long in DOS format to one in Unix format. "x"
  3958. !  * _must_ be an lvalue!
  3959. !  */
  3960. ! #define CONVERT(x) (x = _unixtime( ((short *)&x)[0], ((short *)&x)[1] ))
  3961. ! /*
  3962. !  * common routine for stat() and lstat(); if "lflag" is 0, then symbolic
  3963. !  * links are automatically followed (like stat), if 1 then they are not
  3964. !  * (like lstat)
  3965. !  */
  3966. ! static int do_stat __PROTO((const char *_path, struct stat *st, 
  3967. !     int lflag));
  3968. ! static int
  3969. ! do_stat(_path, st, lflag)
  3970. !     const char *_path;
  3971. !     struct stat *st;
  3972. !     int lflag;
  3973. ! {
  3974. !     long    r;
  3975. !     _DTA    *olddta;
  3976. !     int    nval;
  3977. !     char    path[PATH_MAX];
  3978. !     char    *ext, drv;
  3979. !     int    fd;
  3980. !     short    magic;
  3981. !     _DTA    d;
  3982. !     int    isdot = 0;
  3983. !     if (!_path) {
  3984. !         errno = EFAULT;
  3985. !         return -1;
  3986. !     }
  3987. ! /*
  3988. !  * _unx2dos returns 1 for device names (like /dev/con)
  3989. !  */
  3990. !     nval = _unx2dos(_path, path);
  3991. ! /* for MiNT 0.9 and up, we use the built in stat() call */
  3992. !     if (__mint >= 9) {
  3993. !         r = Fxattr(lflag, path, st);
  3994. !         if (r) {
  3995. !             errno = (int) -r;
  3996. !             return -1;
  3997. !         }
  3998. !         CONVERT(st->st_mtime);
  3999. !         CONVERT(st->st_atime);
  4000. !         CONVERT(st->st_ctime);
  4001. !     /* Most versions of Unix count in 512 byte blocks */
  4002. !         st->st_blocks = (st->st_blocks * st->st_blksize) / 512;
  4003. !     /* if we hit a symbolic link, try to get its size right */
  4004. !         if (lflag && ((st->st_mode & S_IFMT) == S_IFLNK)) {
  4005. !             char buf[PATH_MAX + 1];
  4006. !             char buf1[PATH_MAX + 1];
  4007. !             r = Freadlink(PATH_MAX, buf, path);
  4008. !             if (r < 0)
  4009. !               {
  4010. !                 errno = (int) -r;
  4011. !                 return -1;
  4012. !               }
  4013. !             buf[PATH_MAX] = 0;
  4014. !             _dos2unx (buf, buf1);
  4015. !             st->st_size = strlen (buf1);
  4016. !         }
  4017. !         return 0;
  4018. !     }
  4019. ! /* otherwise, check to see if we have a name like CON: or AUX: */
  4020. !     if (nval == 1) {
  4021. !         st->st_mode = S_IFCHR | 0600;
  4022. !         st->st_attr = 0;
  4023. !         st->st_ino = ++__inode;
  4024. !         st->st_rdev = 0;
  4025. !         st->st_mtime = st->st_ctime = st->st_atime = 
  4026. !             time((time_t *)0) - 2;
  4027. !         st->st_dev = 0;
  4028. !         st->st_nlink = 1;
  4029. !         st->st_uid = geteuid();
  4030. !         st->st_gid = getegid();
  4031. !         st->st_size = st->st_blocks = 0;
  4032. !         st->st_blksize = 1024;
  4033. !         return 0;
  4034. !     }
  4035. ! /* A file name: check for root directory of a drive */
  4036. !     if (path[0] == '\\' && path[1] == 0) {
  4037. !         drv = Dgetdrv() + 'A';
  4038. !         goto rootdir;
  4039. !     }
  4040. !     if ( ((drv = path[0]) != 0) && path[1] == ':' &&
  4041. !          (path[2] == 0 || (path[2] == '\\' && path[3] == 0)) ) {
  4042. ! rootdir:
  4043. !         st->st_mode = S_IFDIR | 0755;
  4044. !         st->st_attr = FA_DIR;
  4045. !         st->st_dev = isupper(drv) ? drv - 'A' : drv - 'a';
  4046. !         st->st_ino = 2;
  4047. !         st->st_mtime = st->st_ctime = st->st_atime = OLDDATE;
  4048. !         goto fill_dir;
  4049. !     }
  4050. ! /* forbid wildcards in path names */
  4051. !     if (index(path, '*') || index(path, '?')) {
  4052. !         errno = ENOENT;
  4053. !         return -1;
  4054. !     }
  4055. ! /* OK, here we're going to have to do an Fsfirst to get the date */
  4056. ! /* NOTE: Fsfirst(".",-1) or Fsfirst("..",-1) both fail under TOS,
  4057. !  * so we kludge around this by using the fact that Fsfirst(".\*.*"
  4058. !  * or "..\*.*" will return the correct file first (except, of course,
  4059. !  * in root directories :-( ).
  4060. !  * NOTE2: Some versions of TOS don't like Fsfirst("RCS\\", -1) either,
  4061. !  * so we do the same thing if the path ends in '\\'.
  4062. !  */
  4063. ! /* find the end of the string */
  4064. !     for (ext = path; ext[0] && ext[1]; ext++) ;
  4065. ! /* add appropriate kludge if necessary */
  4066. !     if (*ext == '.' && (ext == path || ext[-1] == '\\' || ext[-1] == '.')) {
  4067. !         isdot = 1;
  4068. !         strcat(path, "\\*.*");
  4069. !     } else if (*ext == '\\') {
  4070. !         isdot = 1;
  4071. !         strcat(path, "*.*");
  4072. !     }
  4073. !     olddta = Fgetdta();
  4074. !     Fsetdta(&d);
  4075. !     r = Fsfirst(path, 0xff);
  4076. !     Fsetdta(olddta);
  4077. !     if (r < 0) {
  4078. !         if (isdot && r == -ENOENT) goto rootdir;
  4079. !         errno = (int) -r;
  4080. !         return -1;
  4081. !     }    
  4082. !     if (isdot && ((d.dta_name[0] != '.') || (d.dta_name[1]))) {
  4083. !         goto rootdir;
  4084. !     }
  4085. !     st->st_mtime = st->st_ctime = st->st_atime =
  4086. !         _unixtime(d.dta_time, d.dta_date);
  4087. !     if (((drv = *path) != 0) && path[1] == ':')
  4088. !         st->st_dev = toupper(drv) - 'A';
  4089. !     else
  4090. !         st->st_dev = Dgetdrv();
  4091. !     st->st_ino = __inode++;
  4092. !     st->st_attr = d.dta_attribute;
  4093. !     if (__mint && st->st_dev == ('Q' - 'A'))
  4094. !             st->st_mode = 0644 | S_IFIFO;
  4095. !     else {
  4096. !         st->st_mode = 0644 | (st->st_attr & FA_DIR ?
  4097. !                   S_IFDIR | 0111 : S_IFREG);
  4098. !     }
  4099. !     if (st->st_attr & FA_RDONLY)
  4100. !         st->st_mode &= ~0222;    /* no write permission */
  4101. !     if (st->st_attr & FA_HIDDEN)
  4102. !         st->st_mode &= ~0444;    /* no read permission */
  4103. ! /* check for a file with an executable extension */
  4104. !     ext = strrchr(_path, '.');
  4105. !     if (ext) {
  4106. !         if (!strcmp(ext, ".ttp") || !strcmp(ext, ".prg") ||
  4107. !             !strcmp(ext, ".tos") || !strcmp(ext, ".g") ||
  4108. !             !strcmp(ext, ".sh")     || !strcmp(ext, ".bat")) {
  4109. !             st->st_mode |= 0111;
  4110. !         }
  4111. !     }
  4112. !     if ( (st->st_mode & S_IFMT) == S_IFREG) {
  4113. !         if (_x_Bit_set_in_stat) {
  4114. !             if ((fd = (int) Fopen(path,0)) < 0) {
  4115. !                 errno = -fd;
  4116. !                 return -1;
  4117. !             }
  4118. !             magic = 0;
  4119. !             (void)Fread(fd,2,(char *)&magic);
  4120. !             (void)Fclose(fd);
  4121. !             if (magic == 0x601A    /* TOS executable */
  4122. !                 || magic == 0x2321) /* "#!" shell file */
  4123. !                 st->st_mode |= 0111;
  4124. !         }
  4125. !         st->st_size = d.dta_size;
  4126. !     /* in Unix, blocks are measured in 512 bytes */
  4127. !         st->st_blocks = (st->st_size + 511) / 512;
  4128. !         st->st_nlink = 1; /* we dont have hard links */
  4129. !     } else {
  4130. ! fill_dir:
  4131. !         st->st_size = 1024;
  4132. !         st->st_blocks = 2;
  4133. !         st->st_nlink = 2;    /* "foo" && "foo/.." */
  4134. !     }
  4135. !     st->st_rdev = 0;
  4136. !     st->st_uid = geteuid();    /* the current user owns every file */
  4137. !     st->st_gid = getegid();
  4138. !     st->st_blksize = 1024;
  4139. !     return 0;
  4140. ! }
  4141. ! /* 
  4142. !  * fstat: if we're not running under MiNT, this is pretty bogus.
  4143. !  * what we can really find is:
  4144. !  * modification time: via Fdatime()
  4145. !  * file size: via Fseek()
  4146. !  * fortunately, these are the things most programs are interested in.
  4147. !  * BUG: passing an invalid file descriptor gets back a stat structure for
  4148. !  * a tty.
  4149. !  */
  4150. ! int
  4151. ! fstat(fd, st)
  4152. ! int fd;
  4153. ! struct stat *st;
  4154. ! {
  4155. !     long oldplace, r;
  4156. !     _DOSTIME timeptr;
  4157. !     short magic;
  4158. !     if (__mint >= 9) {        /* use FSTAT Fcntl */
  4159. !         r = Fcntl(fd, (long)st, FSTAT);
  4160. !         if (r) {
  4161. !             errno = (int) -r;
  4162. !             return -1;
  4163. !         }
  4164. !         CONVERT(st->st_mtime);
  4165. !         CONVERT(st->st_atime);
  4166. !         CONVERT(st->st_ctime);
  4167. !         st->st_blocks = (st->st_blocks * st->st_blksize) / 512;
  4168. !         return 0;
  4169. !     }
  4170. !     r = Fdatime(&timeptr, fd, 0);
  4171. !     if (r < 0) {            /* assume TTY */
  4172. !         st->st_mode = S_IFCHR | 0600;
  4173. !         st->st_attr = 0;
  4174. !         st->st_mtime = st->st_ctime = st->st_atime =
  4175. !             time((time_t *)0) - 2;
  4176. !         st->st_size = 0;
  4177. !     } else {
  4178. !         st->st_mtime = st->st_atime = st->st_ctime =
  4179. !             _unixtime(timeptr.time, timeptr.date);
  4180. !         st->st_mode = S_IFREG | 0644;        /* this may be false */
  4181. !         st->st_attr = 0;            /* because this is */
  4182. !     /* get current file location */
  4183. !         oldplace = Fseek(0L, fd, SEEK_CUR);
  4184. !         if (oldplace < 0) {        /* can't seek -- must be pipe */
  4185. !             st->st_mode = S_IFIFO | 0644;
  4186. !             st->st_size = 1024;
  4187. !         } else {
  4188. !             r = Fseek(0L, fd, SEEK_END);    /* go to end of file */
  4189. !             st->st_size = r;
  4190. !             (void)Fseek(0L, fd, SEEK_SET);    /* go to start of file */
  4191. !             /* check for executable file */
  4192. !             if (Fread(fd, 2, (char *)&magic) == 2) {
  4193. !                 if (magic == 0x601a || magic == 0x2321)
  4194. !                     st->st_mode |= 0111;
  4195. !             }
  4196. !             (void)Fseek(oldplace, fd, SEEK_SET);
  4197. !         }
  4198. !     }
  4199. ! /* all this stuff is likely bogus as well. sigh. */
  4200. !     st->st_dev = Dgetdrv();
  4201. !     st->st_rdev = 0;
  4202. !     st->st_uid = getuid();
  4203. !     st->st_gid = getgid();
  4204. !     st->st_blksize = 1024;
  4205. ! /* note: most Unixes measure st_blocks in 512 byte units */
  4206. !     st->st_blocks = (st->st_size + 511) / 512;
  4207. !     st->st_ino = ++__inode;
  4208. !     st->st_nlink = 1;
  4209. !     return 0;
  4210. ! }
  4211. ! int
  4212. ! lstat(path, st)
  4213. !     const char *path;
  4214. !     struct stat *st;
  4215. ! {
  4216. !     return do_stat(path, st, 1);
  4217. ! }
  4218.   
  4219.   int
  4220.   stat(path, st)
  4221.       const char *path;
  4222.       struct stat *st;
  4223.   {
  4224. !     return do_stat(path, st, 0);
  4225.   }
  4226. --- 1,12 ----
  4227.   #include <stat.h>
  4228.   #include "lib.h"
  4229.   
  4230. ! __EXTERN int _do_stat __PROTO((const char *_path, struct stat *st, int lflag));
  4231.   
  4232.   int
  4233.   stat(path, st)
  4234.       const char *path;
  4235.       struct stat *st;
  4236.   {
  4237. !     return _do_stat(path, st, 0);
  4238.   }
  4239. *** 43.1    1994/02/15 19:34:32
  4240. --- sync.c    1994/02/28 02:19:34
  4241. ***************
  4242. *** 17,22 ****
  4243. --- 17,23 ----
  4244.   #include <stat.h>
  4245.   #include <errno.h>
  4246.   #include <support.h>
  4247. + #include <string.h>
  4248.   
  4249.   extern int __mint;
  4250.   
  4251. ***************
  4252. *** 34,49 ****
  4253.    *    query all known drives for a valid MinixFs
  4254.    *    if we find one, sync it.
  4255.    */
  4256. ! int sync(void)
  4257.   {
  4258.       long            magic;
  4259.       unsigned long    drives;
  4260.       int                i, rv;
  4261. !     char            path[] = "A:\\";
  4262. !     
  4263.       if (!__mint)
  4264.           return 0;
  4265.   
  4266.       drives = Dsetdrv(Dgetdrv());
  4267.   
  4268.       drives &= ~0x3;    /* don't sync the floppys */
  4269. --- 35,53 ----
  4270.    *    query all known drives for a valid MinixFs
  4271.    *    if we find one, sync it.
  4272.    */
  4273. ! int
  4274. ! sync()
  4275.   {
  4276.       long            magic;
  4277.       unsigned long    drives;
  4278.       int                i, rv;
  4279. !     char path[4];
  4280.       if (!__mint)
  4281.           return 0;
  4282.   
  4283. +     strcpy(path, "A:\\");
  4284. +     
  4285.       drives = Dsetdrv(Dgetdrv());
  4286.   
  4287.       drives &= ~0x3;    /* don't sync the floppys */
  4288. ***************
  4289. *** 76,92 ****
  4290.    *    since MFS 605 always syncs all the buffers, we don't bother
  4291.    *    to get the full path.
  4292.    */
  4293. ! int fsync(fd)
  4294.       int    fd;
  4295.   {
  4296.       int            rv;
  4297.       long        magic     = 0L;
  4298. !     char        path[]    = "A:\\";
  4299.       struct stat    statbuf;
  4300.   
  4301.       if (!__mint)
  4302.           return 0;
  4303.       
  4304.       if (fstat(fd, &statbuf))
  4305.           return -1;            /* errno set from fstat */
  4306.   
  4307. --- 80,98 ----
  4308.    *    since MFS 605 always syncs all the buffers, we don't bother
  4309.    *    to get the full path.
  4310.    */
  4311. ! int
  4312. ! fsync(fd)
  4313.       int    fd;
  4314.   {
  4315.       int            rv;
  4316.       long        magic     = 0L;
  4317. !     char        path[4];
  4318.       struct stat    statbuf;
  4319.   
  4320.       if (!__mint)
  4321.           return 0;
  4322.       
  4323. +     strcpy(path, "A:\\");
  4324.       if (fstat(fd, &statbuf))
  4325.           return -1;            /* errno set from fstat */
  4326.   
  4327. ***************
  4328. *** 114,120 ****
  4329.    * so just do 'cat junk1 >junk2;sync' from your shell
  4330.    * and listen to your harddisk.
  4331.    */
  4332. ! int main (void)
  4333.   {
  4334.       sync();
  4335.       return 0;
  4336. --- 120,127 ----
  4337.    * so just do 'cat junk1 >junk2;sync' from your shell
  4338.    * and listen to your harddisk.
  4339.    */
  4340. ! int
  4341. ! main()
  4342.   {
  4343.       sync();
  4344.       return 0;
  4345. *** 43.1    1994/02/15 19:34:32
  4346. --- tcdrain.c    1994/02/19 13:03:38
  4347. ***************
  4348. *** 1,17 ****
  4349.   /*
  4350.   Public domain termios tcdrain() for the MiNT library
  4351. ! 10 October 1993 entropy@terminator.rs.itd.umich.edu -- first attempt
  4352.   */
  4353.   
  4354.   #include <errno.h>
  4355.   #include <types.h>
  4356.   #include <termios.h>
  4357.   
  4358.   int
  4359.   tcdrain(fd)
  4360.     int fd;
  4361.   {
  4362. !   errno = -EINVAL;
  4363. !   return -1;
  4364.   }
  4365.   
  4366. --- 1,36 ----
  4367.   /*
  4368.   Public domain termios tcdrain() for the MiNT library
  4369. ! 10 October 1993 entropy@terminator.rs.itd.umich.edu
  4370.   */
  4371.   
  4372.   #include <errno.h>
  4373.   #include <types.h>
  4374. + #include <ioctl.h>
  4375. + #include <mintbind.h>
  4376.   #include <termios.h>
  4377.   
  4378. + extern int __mint;
  4379.   int
  4380.   tcdrain(fd)
  4381.     int fd;
  4382.   {
  4383. !   long outq;
  4384. !   long r;
  4385. !   if (__mint < 0x10a)
  4386. !   {
  4387. !     errno = -EINVAL;
  4388. !     return -1;
  4389. !   }
  4390. !   do
  4391. !   {
  4392. !     r = Fcntl((short) fd, &outq, TIOCOUTQ);
  4393. !     if (r < 0) {
  4394. !       errno = (int) -r;
  4395. !       return -1;
  4396. !     }
  4397. !   } while (outq != 0);
  4398. !   return 0;
  4399.   }
  4400.   
  4401. *** 43.1    1994/02/15 19:34:32
  4402. --- tcflush.c    1994/02/19 12:23:00
  4403. ***************
  4404. *** 33,39 ****
  4405.         errno = EINVAL;
  4406.         return -1;
  4407.     }
  4408. !   r = Fcntl((short) fd, flushtype, TIOCFLUSH);
  4409.     if (r < 0) {
  4410.       errno = (int) -r;
  4411.       return -1;
  4412. --- 33,39 ----
  4413.         errno = EINVAL;
  4414.         return -1;
  4415.     }
  4416. !   r = Fcntl((short) fd, &flushtype, TIOCFLUSH);
  4417.     if (r < 0) {
  4418.       errno = (int) -r;
  4419.       return -1;
  4420. *** /dev/null    Mon Feb 28 07:43:04 1994
  4421. --- telldir.c    Mon Feb 28 05:04:00 1994
  4422. ***************
  4423. *** 0 ****
  4424. --- 1,24 ----
  4425. + /* telldir routine */
  4426. + /* under MiNT (v0.9 or better) these use the appropriate system calls.
  4427. +  * under TOS or older versions of MiNT, they use Fsfirst/Fsnext
  4428. +  *
  4429. +  * Written by Eric R. Smith and placed in the public domain
  4430. +  */
  4431. + #include <types.h>
  4432. + #include <limits.h>
  4433. + #include <dirent.h>
  4434. + #include "lib.h"
  4435. + extern int __mint;
  4436. + /* not POSIX */
  4437. + off_t
  4438. + telldir(dirp)
  4439. +     DIR *dirp;
  4440. + {
  4441. +     return dirp->buf.d_off;
  4442. + }
  4443. *** 43.1    1994/02/15 19:34:32
  4444. --- unlink.c    1994/02/27 11:55:56
  4445. ***************
  4446. *** 32,37 ****
  4447. --- 32,39 ----
  4448.       r = (int)Fdelete(name);
  4449.   
  4450.       if (r < 0) {
  4451. +         if ((r == -EPATH) && (_enoent(name)))
  4452. +             r = -ENOENT;
  4453.           errno = -r;
  4454.           return -1;
  4455.       }
  4456. *** /dev/null    Mon Feb 28 07:43:04 1994
  4457. --- vfscanf.c    Mon Feb 28 06:19:02 1994
  4458. ***************
  4459. *** 0 ****
  4460. --- 1,14 ----
  4461. + /* from Dale Schumacher's dLibs */
  4462. + #include <stdio.h>
  4463. + #include <stdarg.h>
  4464. + #include "lib.h"
  4465. + int
  4466. + vfscanf(fp, fmt, arg)
  4467. +   FILE *fp;
  4468. +   const char *fmt;
  4469. +   va_list arg;
  4470. + {
  4471. +   return (_scanf(fp, fgetc, fungetc, fmt, arg));
  4472. + }
  4473. *** /dev/null    Mon Feb 28 07:43:04 1994
  4474. --- vscanf.c    Mon Feb 28 06:17:16 1994
  4475. ***************
  4476. *** 0 ****
  4477. --- 1,14 ----
  4478. + /* from Dale Schumacher's dLibs */
  4479. + #include <stdio.h>
  4480. + #include <stdarg.h>
  4481. + #include "lib.h"
  4482. + int
  4483. + vscanf(fmt, arg)
  4484. +   const char *fmt;
  4485. +   va_list arg;
  4486. + {
  4487. +   return (_scanf(stdin, fgetc, fungetc, fmt, arg));
  4488. + }
  4489. *** 43.1    1994/02/15 20:20:36
  4490. --- purec/Makefile    1994/02/28 17:56:40
  4491. ***************
  4492. *** 299,321 ****
  4493.   ### how to build MINTLIB
  4494.   
  4495.   COMMONSRC :=    a64l.c abort.c abs.c access.c alarm.c alphasor.c atexit.c \
  4496. !   atol.c bblink.c bcmp.c binmode.c bsearch.c calloc.c cfspeed.c chdir.c \
  4497. !   chmod.c clock.c close.c console.c crtinit.c ctermid.c \
  4498. !   ctime.c ctype.c defmode.c dirent.c \
  4499. !   doprnt.c dup.c eprintf.c exec.c execp.c fclose.c fcntl.c fdopen.c fflush.c \
  4500. !   fgetc.c fgets.c filbuf.c findfile.c fopen.c fopenp.c fork.c fprintf.c \
  4501. !   fputc.c fputs.c fread.c frwbin.c fscanf.c fseek.c fsetpos.c ftw.c \
  4502. !   fungetc.c fwrite.c getbuf.c getcwd.c getdtabl.c getenv.c getgroup.c \
  4503. !   gethostn.c getlogin.c getopt.c getpages.c getpass.c getpid.c getpw.c \
  4504. !   getrusag.c gets.c getuid.c getw.c grp.c heapbase.c ic.c ident.c ig.c \
  4505. !   il.c inistack.c initsig.c ioctl.c ip.c isatty.c iw.c kill.c killpg.c \
  4506. !   link.c localtim.c lockf.c lseek.c ltoa.c main.c malloc.c memccpy.c \
  4507.     memchr.c memcmp.c mkdir.c mkfifo.c mknod.c mktemp.c nice.c nlist.c \
  4508. !   obstack.c open.c \
  4509. !   pause.c perror.c pipe.c pgrp.c popen.c printf.c psignal.c putenv.c \
  4510.     qsort.c raise.c \
  4511. !   rand.c random.c read.c realloc.c regexp.c regsup.c rename.c rmdir.c \
  4512. !   sbrk.c scandir.c scanf.c select.c setbuf.c setlocal.c setrlimi.c \
  4513.     setvbuf.c sgtty.c sigactio.c sigblock.c siglist.c signal.c sleep.c \
  4514.     spawn.c spawnve.c spawnvp.c sprintf.c sscanf.c stat.c statfs.c stksiz.c \
  4515.     strcat.c strchr.c strcmp.c strcoll.c strcpy.c strcspn.c strdup.c \
  4516. --- 299,335 ----
  4517.   ### how to build MINTLIB
  4518.   
  4519.   COMMONSRC :=    a64l.c abort.c abs.c access.c alarm.c alphasor.c atexit.c \
  4520. !   atoi.c atol.c bblink.c bcmp.c binmode.c bsearch.c calloc.c \
  4521. !   cfgetisp.c cfgetosp.c cfsetisp.c cfsetosp.c chdir.c \
  4522. !   chmod.c chown.c clock.c close.c closedir.c console.c crtinit.c ctermid.c \
  4523. !   ctime.c ctype.c defmode.c \
  4524. !   doprnt.c do_lock.c do_stat.c dup.c dup2.c eprintf.c \
  4525. !   execl.c execle.c execp.c execv.c execve.c \
  4526. !   fclose.c fcntl.c fdopen.c fflush.c \
  4527. !   fgetc.c fgetpos.c fgets.c filbuf.c findfile.c flock.c fopen.c \
  4528. !   fopen_i.c fopenp.c fork.c fprintf.c \
  4529. !   fputc.c fputs.c fread.c freopen.c frwbin.c \
  4530. !   fscanf.c fseek.c fsetpos.c fstat.c ftell.c ftw.c \
  4531. !   fungetc.c fwrite.c getbuf.c getcwd.c \
  4532. !   getdtabl.c getenv.c getegid.c geteuid.c getgid.c getgroup.c \
  4533. !   gethostn.c getlogin.c getopt.c getpages.c \
  4534. !   getpass.c getpid.c getppid.c getpw.c \
  4535. !   getrusag.c gets.c getuid.c getw.c getwd.c \
  4536. !   grp.c heapbase.c ic.c ident.c ig.c \
  4537. !   il.c inistack.c initsig.c inode.c ioctl.c \
  4538. !   ip.c isatty.c isctty.c iw.c kill.c killpg.c \
  4539. !   l64a.c labs.c ldiv.c link.c localtim.c lockf.c lseek.c lstat.c \
  4540. !   ltoa.c main.c malloc.c memccpy.c \
  4541.     memchr.c memcmp.c mkdir.c mkfifo.c mknod.c mktemp.c nice.c nlist.c \
  4542. !   obstack.c open.c opendir.c \
  4543. !   pause.c perror.c pipe.c pgrp.c popen.c \
  4544. !   printf.c psignal.c putenv.c puts.c \
  4545.     qsort.c raise.c \
  4546. !   rand.c random.c read.c readdir.c realloc.c \
  4547. !   regexp.c regsup.c rename.c rewind.c rewinddi.c rmdir.c \
  4548. !   sbrk.c scandir.c scanf.c seekdir.c select.c \
  4549. !   setbuf.c setegid.c seteuid.c setlocal.c \
  4550. !   setregid.c setreuid.c setrlimi.c setgid.c setuid.c \
  4551.     setvbuf.c sgtty.c sigactio.c sigblock.c siglist.c signal.c sleep.c \
  4552.     spawn.c spawnve.c spawnvp.c sprintf.c sscanf.c stat.c statfs.c stksiz.c \
  4553.     strcat.c strchr.c strcmp.c strcoll.c strcpy.c strcspn.c strdup.c \
  4554. ***************
  4555. *** 323,331 ****
  4556.     strncpy.c strnicmp.c strpbrk.c strrchr.c strrev.c strspn.c strstr.c \
  4557.     strtok.c strtol.c strtoul.c strupr.c symlink.c sysconf.c system.c \
  4558.     sysvar.c tcattr.c tcbreak.c tcdrain.c tcflow.c tcflush.c tcpgrp.c \
  4559. !   textio.c thread.c time.c timeoday.c times.c tmpfile.c tmpnam.c \
  4560. !   toxxx.c truncate.c ttyname.c uname.c unlink.c unx2dos.c utime.c \
  4561. !   utmp.c vfprintf.c vprintf.c wait.c \
  4562.     wait3.c waitpid.c wcmb.c \
  4563.     wcscat.c wcscmp.c wcscpy.c wcslen.c wnull.c write.c wtmp.c 
  4564.   COMMONSRC := $(addprefix $(COMMONDIR)/,$(COMMONSRC))
  4565. --- 337,345 ----
  4566.     strncpy.c strnicmp.c strpbrk.c strrchr.c strrev.c strspn.c strstr.c \
  4567.     strtok.c strtol.c strtoul.c strupr.c symlink.c sysconf.c system.c \
  4568.     sysvar.c tcattr.c tcbreak.c tcdrain.c tcflow.c tcflush.c tcpgrp.c \
  4569. !   telldir.c textio.c thread.c time.c timeoday.c times.c tmpfile.c tmpnam.c \
  4570. !   toxxx.c truncate.c ttyname.c uidgid.c uname.c unlink.c unx2dos.c utime.c \
  4571. !   utmp.c vfprintf.c vfscanf.c vprintf.c vscanf.c wait.c \
  4572.     wait3.c waitpid.c wcmb.c \
  4573.     wcscat.c wcscmp.c wcscpy.c wcslen.c wnull.c write.c wtmp.c 
  4574.   COMMONSRC := $(addprefix $(COMMONDIR)/,$(COMMONSRC))
  4575. *** 43.1    1994/02/15 20:20:36
  4576. --- purec/mintlib.prj    1994/02/28 18:13:30
  4577. ***************
  4578. *** 19,24 ****
  4579. --- 19,25 ----
  4580.   ..\alphasor.c
  4581.   ..\atexit.c
  4582.   ; ..\atof.c        (use the version in pcstdlib/tcstdlib)
  4583. + ..\atoi.c
  4584.   ..\atol.c
  4585.   ..\bblink.c
  4586.   ..\bcmp.c
  4587. ***************
  4588. *** 26,36 ****
  4589.   ..\bsearch.c
  4590.   bzero.c
  4591.   ..\calloc.c
  4592. ! ..\cfspeed.c
  4593.   ..\chdir.c
  4594.   ..\chmod.c
  4595.   ..\clock.c
  4596.   ..\close.c
  4597.   ..\console.c
  4598.   ..\crtinit.c [-P -S- -T-]
  4599.   ..\ctermid.c
  4600. --- 27,42 ----
  4601.   ..\bsearch.c
  4602.   bzero.c
  4603.   ..\calloc.c
  4604. ! ..\cfgetisp.c
  4605. ! ..\cfgetosp.c
  4606. ! ..\cfsetisp.c
  4607. ! ..\cfsetosp.c
  4608.   ..\chdir.c
  4609.   ..\chmod.c
  4610. + ..\chown.c
  4611.   ..\clock.c
  4612.   ..\close.c
  4613. + ..\closedir.c
  4614.   ..\console.c
  4615.   ..\crtinit.c [-P -S- -T-]
  4616.   ..\ctermid.c
  4617. ***************
  4618. *** 38,68 ****
  4619.   ..\ctype.c
  4620.   ..\defmode.c
  4621.   ; ..\difftime.c        (pick this up from mintflt.lib or mint881.lib)
  4622. - ..\dirent.c
  4623.   ..\doprnt.c
  4624.   ..\dup.c
  4625.   ..\eprintf.c
  4626. ! ..\exec.c
  4627.   ..\execp.c
  4628.   ..\fclose.c
  4629.   ..\fcntl.c
  4630.   ..\fdopen.c
  4631.   ..\fflush.c
  4632.   ..\fgetc.c
  4633.   ..\fgets.c
  4634.   ..\filbuf.c
  4635.   ..\findfile.c
  4636.   ..\fopen.c
  4637.   ..\fopenp.c
  4638.   ..\fork.c
  4639.   ..\fprintf.c
  4640.   ..\fputc.c
  4641.   ..\fputs.c
  4642.   ..\fread.c
  4643.   ..\frwbin.c
  4644.   ..\fscanf.c
  4645.   ..\fseek.c
  4646.   ..\fsetpos.c
  4647.   ..\ftw.c
  4648.   ..\fungetc.c
  4649.   ..\fwrite.c
  4650. --- 44,85 ----
  4651.   ..\ctype.c
  4652.   ..\defmode.c
  4653.   ; ..\difftime.c        (pick this up from mintflt.lib or mint881.lib)
  4654.   ..\doprnt.c
  4655. + ..\do_lock.c
  4656. + ..\do_stat.c
  4657.   ..\dup.c
  4658. + ..\dup2.c
  4659.   ..\eprintf.c
  4660. ! ..\execl.c
  4661. ! ..\execle.c
  4662.   ..\execp.c
  4663. + ..\execv.c
  4664. + ..\execve.c
  4665.   ..\fclose.c
  4666.   ..\fcntl.c
  4667.   ..\fdopen.c
  4668.   ..\fflush.c
  4669.   ..\fgetc.c
  4670. + ..\fgetpos.c
  4671.   ..\fgets.c
  4672.   ..\filbuf.c
  4673.   ..\findfile.c
  4674. + ..\flock.c
  4675.   ..\fopen.c
  4676. + ..\fopen_i.c
  4677.   ..\fopenp.c
  4678.   ..\fork.c
  4679.   ..\fprintf.c
  4680.   ..\fputc.c
  4681.   ..\fputs.c
  4682.   ..\fread.c
  4683. + ..\freopen.c
  4684.   ..\frwbin.c
  4685.   ..\fscanf.c
  4686.   ..\fseek.c
  4687.   ..\fsetpos.c
  4688. + ..\fstat.c
  4689. + ..\ftell.c
  4690.   ..\ftw.c
  4691.   ..\fungetc.c
  4692.   ..\fwrite.c
  4693. ***************
  4694. *** 70,75 ****
  4695. --- 87,94 ----
  4696.   ..\getcwd.c
  4697.   ..\getdtabl.c
  4698.   ..\getenv.c
  4699. + ..\getegid.c
  4700. + ..\geteuid.c
  4701.   ..\getgroup.c
  4702.   ..\gethostn.c
  4703.   ..\getlogin.c
  4704. ***************
  4705. *** 77,87 ****
  4706. --- 96,108 ----
  4707.   ..\getpages.c
  4708.   ..\getpass.c
  4709.   ..\getpid.c
  4710. + ..\getppid.c
  4711.   ..\getpw.c
  4712.   ..\getrusag.c
  4713.   ..\gets.c
  4714.   ..\getuid.c
  4715.   ..\getw.c
  4716. + ..\getwd.c
  4717.   ..\grp.c
  4718.   ..\heapbase.c
  4719.   ..\ic.c
  4720. ***************
  4721. *** 90,105 ****
  4722. --- 111,132 ----
  4723.   ..\il.c
  4724.   ..\inistack.c
  4725.   ..\initsig.c
  4726. + ..\inode.c
  4727.   ..\ioctl.c
  4728.   ..\ip.c
  4729.   ..\isatty.c
  4730. + ..\isctty.c
  4731.   ..\iw.c
  4732.   ..\kill.c
  4733.   ..\killpg.c
  4734. + ..\l64a.c
  4735. + ..\labs.c
  4736. + ..\ldiv.c
  4737.   ..\link.c
  4738.   ..\localtim.c
  4739.   ..\lockf.c
  4740.   ..\lseek.c
  4741. + ..\lstat.c
  4742.   ..\ltoa.c
  4743.   ..\main.c [-P]
  4744.   ..\malloc.c
  4745. ***************
  4746. *** 115,120 ****
  4747. --- 142,148 ----
  4748.   ..\nlist.c
  4749.   ..\obstack.c
  4750.   ..\open.c
  4751. + ..\opendir.c
  4752.   ..\pause.c
  4753.   ..\perror.c
  4754.   ..\pipe.c
  4755. ***************
  4756. *** 123,145 ****
  4757. --- 151,184 ----
  4758.   ..\printf.c
  4759.   ..\psignal.c
  4760.   ..\putenv.c
  4761. + ..\puts.c
  4762.   ..\qsort.c [-S -T]
  4763.   ..\raise.c
  4764.   ..\rand.c
  4765.   ..\random.c
  4766.   ..\read.c
  4767. + ..\readdir.c
  4768.   ..\realloc.c
  4769.   ..\regexp.c
  4770.   ..\regsup.c
  4771.   ..\rename.c
  4772. + ..\rewind.c
  4773. + ..\rewinddi.c
  4774.   ..\rmdir.c
  4775.   ..\sbrk.c
  4776.   ..\scandir.c
  4777.   ..\scanf.c
  4778. + ..\seekdir.c
  4779.   ..\select.c
  4780.   ..\setbuf.c
  4781. + ..\setegid.c
  4782. + ..\seteuid.c
  4783. + ..\setgid.c
  4784.   ..\setlocal.c
  4785. + ..\setregid.c
  4786. + ..\setreuid.c
  4787.   ..\setrlimi.c
  4788. + ..\setuid.c
  4789.   ..\setvbuf.c
  4790.   ..\sgtty.c
  4791.   ..\sigactio.c
  4792. ***************
  4793. *** 189,194 ****
  4794. --- 228,234 ----
  4795.   ..\tcflow.c
  4796.   ..\tcflush.c
  4797.   ..\tcpgrp.c
  4798. + ..\telldir.c
  4799.   ..\textio.c
  4800.   ..\thread.c [-P -S-]
  4801.   ..\time.c
  4802. ***************
  4803. *** 199,211 ****
  4804. --- 239,254 ----
  4805.   ..\toxxx.c
  4806.   ..\truncate.c
  4807.   ..\ttyname.c
  4808. + ..\uidgid.c
  4809.   ..\uname.c
  4810.   ..\unlink.c
  4811.   ..\unx2dos.c
  4812.   ..\utime.c
  4813.   ..\utmp.c
  4814.   ..\vfprintf.c
  4815. + ..\vfscanf.c
  4816.   ..\vprintf.c
  4817. + ..\vscanf.c
  4818.   ..\wait.c
  4819.   ..\wait3.c
  4820.   ..\waitpid.c
  4821. *** 43.1    1994/02/15 20:23:28
  4822. --- sozobon/makefile    1994/02/28 17:41:06
  4823. ***************
  4824. *** 47,93 ****
  4825.   
  4826.   # These are in alphabetical order to make it easy to find one.
  4827.   OBJECTS = \
  4828. !     abort.o abs.o access.o alarm.o alloca.o alphasor.o \
  4829. !     atexit.o atol.o \
  4830.       bcmp.o bcopy.o binmode.o bsearch.o bzero.o \
  4831. !     calloc.o chdir.o chmod.o clock.o close.o console.o crtinit.o \
  4832. !     ctermid.o ctime.o ctype.o cuserid.o \
  4833. !     defmode.o difftime.o dirent.o doprnt.o dup.o \
  4834. !     eprintf.o exec.o execp.o\
  4835. !     fclose.o fcntl.o fdopen.o fflush.o ffs.o fgetc.o fgets.o filbuf.o \
  4836. !     findfile.o fopen.o fopenp.o fork.o fprintf.o fputc.o fputs.o \
  4837. !     fread.o frwbin.o fscanf.o fseek.o fsetpos.o ftw.o fungetc.o \
  4838.       fwrite.o \
  4839. !     getbuf.o getcwd.o getdtabl.o getenv.o getgroup.o gethostn.o \
  4840. !     getlogin.o getopt.o getpages.o getpass.o getpid.o getpw.o \
  4841. !     getrusag.o gets.o getuid.o getw.o grp.o \
  4842.       heapbase.o \
  4843. !     ic.o ident.o ig.o il.o inistack.o initsig.o ioctl.o ip.o \
  4844. !     isatty.o iw.o \
  4845.       kill.o killpg.o \
  4846. !     linea.o link.o lmalloc.o localtim.o lockf.o lseek.o ltoa.o \
  4847. !     main.o malloc.o memccpy.o memchr.o memcmp.o mkdir.o mknod.o \
  4848. !     mktemp.o \
  4849. !     nice.o \
  4850. !     obstack.o open.o osbind.o \
  4851.       pause.o perror.o pgrp.o pipe.o popen.o printf.o psignal.o putenv.o \
  4852.       qsort.o \
  4853. !     raise.o rand.o random.o read.o realloc.o regexp.o regsup.o \
  4854. !     rename.o rmdir.o \
  4855. !     sbrk.o scandir.o scanf.o select.o setbuf.o setjmp.o setlocal.o \
  4856. !     setrlimi.o setvbuf.o sgtty.o sigactio.o sigblock.o siglist.o \
  4857.       signal.o sleep.o sozolong.o sozulong.o spawn.o spawnve.o \
  4858.       spawnvp.o sprintf.o sscanf.o stat.o statfs.o stksiz.o strcat.o \
  4859.       strchr.o strcmp.o strcoll.o strcpy.o strcspn.o strdup.o \
  4860.       strerror.o strftime.o stricmp.o strlen.o strlwr.o strncat.o \
  4861.       strncmp.o strncpy.o strnicmp.o strpbrk.o strrchr.o strrev.o \
  4862.       strspn.o strstr.o strtok.o strtol.o strtoul.o strupr.o symlink.o \
  4863. !     sysconf.o system.o sysvar.o \
  4864. !     textio.o thread.o time.o timeoday.o times.o tmpfile.o tmpnam.o \
  4865. !     toxxx.o truncate.o ttyname.o \
  4866. !     uname.o unlink.o unx2dos.o utime.o utmp.o \
  4867. !     vfork.o vfprintf.o vprintf.o \
  4868. !     wait.o wait3.o waitpid.o wcmb.o write.o wtmp.o
  4869.   
  4870.   # Rule to handle .cpp files
  4871.   .SUFFIXES: .cpp
  4872. --- 47,109 ----
  4873.   
  4874.   # These are in alphabetical order to make it easy to find one.
  4875.   OBJECTS = \
  4876. !     a64l.o abort.o abs.o access.o alarm.o alloca.o alphasor.o \
  4877. !     atexit.o atoi.o atol.o \
  4878.       bcmp.o bcopy.o binmode.o bsearch.o bzero.o \
  4879. !     calloc.o cfgetisp.o cfgetosp.o cfsetisp.o cfsetosp.o \
  4880. !     chdir.o chmod.o chown.o clock.o close.o closedir.o console.o \
  4881. !     crtinit.o ctermid.o ctime.o ctype.o cuserid.o \
  4882. !     defmode.o difftime.o div.o doprnt.o \
  4883. !     do_lock.o do_stat.o dup.o dup2.o \
  4884. !     eprintf.o execl.o execle.o execp.o execv.o execve.o \
  4885. !     fclose.o fcntl.o fdopen.o fflush.o \
  4886. !     ffs.o fgetc.o fgetpos.o fgets.o filbuf.o \
  4887. !     findfile.o flock.o fopen.o fopen_i.o fopenp.o \
  4888. !     fork.o fprintf.o fputc.o fputs.o \
  4889. !     fread.o freopen.o frwbin.o fscanf.o fseek.o fsetpos.o \
  4890. !     fstat.o ftell.o ftw.o fungetc.o \
  4891.       fwrite.o \
  4892. !     getbuf.o getcwd.o getdtabl.o getegid.o geteuid.o getenv.o \
  4893. !     getgid.o getgroup.o gethostn.o \
  4894. !     getlogin.o getopt.o getpages.o \
  4895. !     getpass.o getpid.o getppid.o getpw.o \
  4896. !     getrusag.o gets.o getuid.o getw.o getwd.o grp.o \
  4897.       heapbase.o \
  4898. !     ic.o ident.o ig.o il.o inistack.o initsig.o inode.o ioctl.o ip.o \
  4899. !     isatty.o isctty.o iw.o \
  4900.       kill.o killpg.o \
  4901. !     l64a.o labs.o ldiv.o linea.o link.o lmalloc.o localtim.o \
  4902. !     lockf.o lseek.o lstat.o ltoa.o \
  4903. !     main.o malloc.o memccpy.o memchr.o memcmp.o memset.o mkdir.o \
  4904. !     mkfifo.o mknod.o mktemp.o \
  4905. !     nice.o nlist.o \
  4906. !     obstack.o open.o opendir.o osbind.o \
  4907.       pause.o perror.o pgrp.o pipe.o popen.o printf.o psignal.o putenv.o \
  4908. +     putpwent.o puts.o \
  4909.       qsort.o \
  4910. !     raise.o rand.o random.o read.o readdir.o \
  4911. !     realloc.o regexp.o regsup.o \
  4912. !     rename.o rewind.o rewinddi.o rmdir.o \
  4913. !     sbrk.o scandir.o scanf.o seekdir.o select.o \
  4914. !     setbuf.o setegid.o seteuid.o setgid.o setjmp.o setlocal.o \
  4915. !     setregid.o setreuid.o setrlimi.o setuid.o setvbuf.o sgtty.o \
  4916. !     sigactio.o sigblock.o siglist.o \
  4917.       signal.o sleep.o sozolong.o sozulong.o spawn.o spawnve.o \
  4918.       spawnvp.o sprintf.o sscanf.o stat.o statfs.o stksiz.o strcat.o \
  4919.       strchr.o strcmp.o strcoll.o strcpy.o strcspn.o strdup.o \
  4920.       strerror.o strftime.o stricmp.o strlen.o strlwr.o strncat.o \
  4921.       strncmp.o strncpy.o strnicmp.o strpbrk.o strrchr.o strrev.o \
  4922.       strspn.o strstr.o strtok.o strtol.o strtoul.o strupr.o symlink.o \
  4923. !     sync.o sysconf.o system.o sysvar.o \
  4924. !     tcattr.o tcbreak.o tcdrain.o tcflow.o tcflush.o \
  4925. !     tcpgrp.o telldir.o textio.o \
  4926. !     thread.o time.o timeoday.o times.o tmpfile.o tmpnam.o toxxx.o \
  4927. !     truncate.o ttyname.o \
  4928. !     uidgid.o uname.o unlink.o unx2dos.o utime.o utmp.o \
  4929. !     vfork.o vfprintf.o vfscanf.o vprintf.o vscanf.o \
  4930. !     wait.o wait3.o waitpid.o wcmb.o wcscat.o \
  4931. !     wcscmp.o wcscpy.o wcslen.o \
  4932. !     wnull.o write.o wtmp.o
  4933.   
  4934.   # Rule to handle .cpp files
  4935.   .SUFFIXES: .cpp
  4936. ***************
  4937. *** 106,117 ****
  4938.   # Make sure the targets get built if necessary
  4939.   alloca.o: alloca.cpp
  4940.   bcopy.o: bcopy.cpp
  4941. - bzero.o: bzero.cpp
  4942.   crt0.o: crt0.cpp
  4943.   osbind.o: osbind.cpp
  4944.   setjmp.o: setjmp.cpp
  4945.   vfork.o: vfork.cpp
  4946.   
  4947.   # If you're using 1.33i's make or ar, this command will fail spectacularly
  4948.   # for the first build; you'll have to build it by hand, a few files
  4949.   # at a time.  After that, if you only change a few files at a time,
  4950. --- 122,145 ----
  4951.   # Make sure the targets get built if necessary
  4952.   alloca.o: alloca.cpp
  4953.   bcopy.o: bcopy.cpp
  4954.   crt0.o: crt0.cpp
  4955.   osbind.o: osbind.cpp
  4956.   setjmp.o: setjmp.cpp
  4957.   vfork.o: vfork.cpp
  4958.   
  4959. + # bzero.cpp contains both bzero() and memset().
  4960. + bzero.o: bzero.cpp
  4961. +     $(CPP) $(CPPFLAGS) -DLbzero bzero.cpp bzero.i
  4962. +     mit2mot bzero.i
  4963. +     $(RM) bzero.i
  4964. +     $(AS) $(AFLAGS) bzero.s
  4965. + memset.o: bzero.cpp
  4966. +     $(CPP) $(CPPFLAGS) -DLmemset bzero.cpp memset.i
  4967. +     mit2mot memset.i
  4968. +     $(RM) memset.i
  4969. +     $(AS) $(AFLAGS) memset.s
  4970.   # If you're using 1.33i's make or ar, this command will fail spectacularly
  4971.   # for the first build; you'll have to build it by hand, a few files
  4972.   # at a time.  After that, if you only change a few files at a time,
  4973. *** 43.1    1994/02/15 20:23:28
  4974. --- sozobon/readme    1994/02/19 12:50:50
  4975. ***************
  4976. *** 1,4 ****
  4977. ! MiNT library for Heat-n-Serve/Sozobon C, patchlevel 34
  4978.   
  4979.   This is a port of Eric Smith's MiNT library to Heat-n-Serve C, based on
  4980.   Dave Gymer's original port.  It replaces the files dlibs.a, dstart.o,
  4981. --- 1,4 ----
  4982. ! MiNT library for Heat-n-Serve/Sozobon C, patchlevel 43
  4983.   
  4984.   This is a port of Eric Smith's MiNT library to Heat-n-Serve C, based on
  4985.   Dave Gymer's original port.  It replaces the files dlibs.a, dstart.o,
  4986. ***************
  4987. *** 16,22 ****
  4988.   archives:
  4989.   
  4990.       mntincXX.zoo
  4991. !         The library header files for version XX (currently 30).  If
  4992.           you're using the MiNTlibs at all, you should already have these.
  4993.       mnthlbXX.zoo
  4994.           The binary distribution of the MiNTlibs.  You will need this for
  4995. --- 16,22 ----
  4996.   archives:
  4997.   
  4998.       mntincXX.zoo
  4999. !         The library header files for version XX (currently 43).  If
  5000.           you're using the MiNTlibs at all, you should already have these.
  5001.       mnthlbXX.zoo
  5002.           The binary distribution of the MiNTlibs.  You will need this for
  5003. ***************
  5004. *** 45,53 ****
  5005.       ps.c
  5006.       Source for a process listing utility, as an example of MiNT
  5007.       programming.
  5008. -     orig/
  5009. -         Some .s and .c files from previous distributions which are now
  5010. -         built from .cpp files.  You shouldn't need these.
  5011.   
  5012.   WHAT TO DO WITH IT:
  5013.   
  5014. --- 45,50 ----
  5015. ***************
  5016. *** 59,71 ****
  5017.       somewhere where make can find them.
  5018.   
  5019.   2)  From the main source directory, delete all files beginning with '_',
  5020. !     as well as linea.c and inistack.c.  Copy all the .s files from this
  5021. !     directory, as well as termcap.c and makefile, to the main source
  5022. !     directory.
  5023.   
  5024.   3)  Edit osbind.h from the MiNT include distribution.  Find the macro
  5025. !     definitions for trap_14_wllwwwwwlw(), spanning lines 1309-1349 and
  5026. !     1456-1500 (or thereabouts).  Delete every scrap of white space you
  5027.       can from these macros.  Otherwise, they overrun HSC's static line
  5028.       buffer.
  5029.   
  5030. --- 56,68 ----
  5031.       somewhere where make can find them.
  5032.   
  5033.   2)  From the main source directory, delete all files beginning with '_',
  5034. !     as well as alglobal.c, linea.c and inistack.c.  Copy all the .s
  5035. !     files from this directory, as well as termcap.c and makefile, to the
  5036. !     main source directory.
  5037.   
  5038.   3)  Edit osbind.h from the MiNT include distribution.  Find the macro
  5039. !     definitions for trap_14_wllwwwwwlw(), spanning lines 1318-1358 and
  5040. !     1465-1509 (or thereabouts).  Delete every scrap of white space you
  5041.       can from these macros.  Otherwise, they overrun HSC's static line
  5042.       buffer.
  5043.   
  5044.